Jump to content

Chaos game: Difference between revisions

Added solution for Action!
m (→‎{{header|Phix}}: added syntax colouring, made p2js compatible)
(Added solution for Action!)
Line 143:
xchg cx,di
ret</lang>
 
=={{header|Action!}}==
<lang Action!>PROC Main()
INT x,w=[220],h=[190]
BYTE y,i,CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
 
Graphics(8+16)
Color=1
COLOR1=$0C
COLOR2=$02
 
x=Rand(w)
y=Rand(h)
DO
i=Rand(3)
IF i=0 THEN
x==/2
y==/2
ELSEIF i=1 THEN
x=w/2+(w/2-x)/2
y=h-(h-y)/2
ELSE
x=w-(w-x)/2
y=y/2
FI
Plot((320-w)/2+x,191-y)
UNTIL CH#$FF
OD
CH=$FF
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Chaos_game.png Screenshot from Atari 8-bit computer]
 
=={{header|BASIC}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.