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

32 lines
524 B
Text

#Chaos game
ancho = 500 : alto = 300
x = Int(Rand * ancho)
y = Int(Rand * alto)
Clg
FastGraphics
Graphsize ancho , alto
For iteracion = 1 To 30000
vertice = Int(Rand * 3) + 1
Begin Case
Case vertice = 1
x = x / 2
y = y / 2
Color red
Case vertice = 2
x = (ancho/2) + ((ancho/2)-x) / 2
y = alto - (alto-y) / 2
Color green
Case vertice = 3
x = ancho - (ancho-x) / 2
y = y / 2
Color blue
End Case
#Pset (x,y),vertice
Plot (x,y)
Next iteracion
Refresh
ImgSave "chaos_game.jpg", "jpg"
End