Chaos game: Difference between revisions
Content added Content deleted
(Added FutureBasic solution) |
|||
Line 1,106: | Line 1,106: | ||
{{FormulaeEntry|page=https://formulae.org/?script=examples/Chaos_game}} |
{{FormulaeEntry|page=https://formulae.org/?script=examples/Chaos_game}} |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
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 |
|||
</syntaxhighlight> |
|||
[[file:Chaos game FB.png]] |
|||
=={{header|GML}}== |
=={{header|GML}}== |