RosettaCodeData/Task/Chaos-game/FutureBasic/chaos-game.basic

28 lines
523 B
Plaintext

void local fn DoIt
long w = 460, h = 400, i, x = rnd(w), y = rnd(h)
for i = 1 to 50000
select ( rnd(3)-1 )
case 1
x = w/2+(w/2-x)/2
y = h-(h-y)/2
pen ,fn ColorRed
case 2
x = w-(w-x)/2
y = y/2
pen ,fn ColorGreen
case else
x = x/2
y = y/2
pen ,fn ColorBlue
end select
line x-0.5,y-0.5,x+0.5,y+0.5
next
end fn
window 1, @"Chaos Game", (0,0,460,400)
WindowSetBackgroundColor( 1, fn ColorWhite )
fn DoIt
HandleEvents