Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
School themes from USSR and EurAsia
#25
Circle Diagram    https://qb64forum.alephc.xyz/index.php?topic=4367
November 06, 2021, 12:12:44 pm

Visualization pie chart 4 algorithms simultaneously

Code: (Select All)
Screen 12: Randomize Timer 'diagram.bas  Russian Circle Diagram
N = 12: s = 0: Dim d(N+5),r(N+1+5):
For i = 1 To N: d(i) = Int(Rnd * 90+9): s = s+d(i): Print d(i): Next: Print "SUM= "; s
For i = 2 To N: r(i) = r(i-1)+d(i) * 2 * 3.1416 / s: Next: r(N+1) = r(1)

For i = 2 To N+1: For j = 1 To 100: Circle (150,100),j,i,r(i-1),r(i)
    Circle (149,99),j,i,r(i-1),r(i): Circle (151,99),j,i,r(i-1),r(i)
_Delay .002: Next: Next

For j = 1 To 100: For i = 2 To N+1: Circle (350,100),j,i,r(i-1),r(i)
    Circle (349,100),j,i,r(i-1),r(i): Circle (351,99),j,i,r(i-1),r(i)
Next: _Delay .01: Next

_Delay 1: Cls 'Screen 12: Randomize Timer diagout.bas  Russian Circle Diagram
N = 16: s = 0 ': Dim d(N),r(N+1):
For i = 1 To N: d(i) = Int(Rnd * 90+9): s = s+d(i): Print d(i): Next: Print "SUM= "; s
For i = 2 To N: r(i) = r(i-1)+d(i) * 2 * 3.1416 / s: Next: r(N+1) = r(1)

For i = 2 To N+1 Step 2: For j = 1 To 100: Circle (150,100),j,i,r(i-1),r(i)
    Circle (149,99),j,i,r(i-1),r(i): Circle (151,99),j,i,r(i-1),r(i)
_Delay .002: Next: Next

For i = 3 To N+1 Step 2: For j = 100 To 1 Step -1: Circle (150,100),j,i,r(i-1),r(i)
    Circle (149,99),j,i,r(i-1),r(i): Circle (151,99),j,i,r(i-1),r(i)
_Delay .002: Next: Next

For j = 1 To 100: For i = 2 To N+1
    If (i Mod 2) = 0 Then Circle (350,100),j,i,r(i-1),r(i): Circle (349,99),j,i,r(i-1),r(i): Circle (351,99),j,i,r(i-1),r(i)
        If (i Mod 2) = 1 Then Circle (350,100),100-j,i,r(i-1),r(i): Circle (349,99),100-j,i,r(i-1),r(i): Circle (351,99),100-j,i,r(i-1),r(i)
Next: _Delay .01: Next: End
Each animation is less than 100 KB

[Image: diagram.gif]
[Image: diagout.gif]




.bas   diagram.bas (Size: 1.53 KB / Downloads: 92)

https://qbjs.org/?code=U2NyZWVuIDEyOiBSY...cDsjogRW5k
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply


Messages In This Thread
School themes from USSR and EurAsia - by DANILIN - 05-02-2022, 12:31 PM
RE: School themes from USSR and EurAsia - by Pete - 11-07-2022, 10:48 PM
RE: School themes from USSR and EurAsia - by Jack - 11-08-2022, 03:07 AM
RE: School themes from USSR and EurAsia - by Jack - 11-08-2022, 03:19 PM
RE: School themes from USSR and EurAsia - by Pete - 11-08-2022, 04:39 PM
RE: School themes from USSR and EurAsia - by Pete - 11-08-2022, 03:34 PM
RE: School themes from USSR and EurAsia - by DANILIN - 12-19-2024, 04:19 PM



Users browsing this thread: 1 Guest(s)