RosettaCodeData/Task/Chaos-game/FreeBASIC/chaos-game.basic
2023-07-01 13:44:08 -04:00

29 lines
564 B
Text

' Chaos game
Const ancho = 320, alto = 240
Dim As Integer x, y, iteracion, vertice
x = Int(Rnd * ancho)
y = Int(Rnd * alto)
Screenres ancho, alto, 8
Cls
For iteracion = 1 To 30000
vertice = Int(Rnd * 3) + 1
Select Case vertice
Case 1
x = x / 2
y = y / 2
vertice = 4 'red
Case 2
x = (ancho/2) + ((ancho/2)-x) / 2
y = alto - (alto-y) / 2
vertice = 2 'green
Case 3
x = ancho - (ancho-x) / 2
y = y / 2
vertice = 1 'blue
End Select
Pset (x,y),vertice
Next iteracion
Sleep
End