Langton's ant: Difference between revisions

mNo edit summary
Line 2,224:
 
=={{header|Run BASIC}}==
<lang Runbasic>dim plane(100,100)
'move up=1 right=2 down=3 left=4
' ---------------------------------
dim plane(100,100)
x = 50: y = 50
mx = 100
 
while (x>0) and (x<100) and (y>0) and (y<100)
if plane(x,y) then
Line 2,239 ⟶ 2,236:
if nxt > 4 then nxt = 1
end if
 
x = x + (nxt = 2) - (nxt = 4)
y = y + (nxt = 3) - (nxt = 1)
plane(x,y) = (plane(x,y) <> 1)
mx = min(x,mx)
wend
 
graphic #g, 100,100
for x = mx to 100
for y = 1 to 100
print chr$((plane(x,y)*3) + 32);
if plane(x,y) = 1 then #g "color green ; set "; x; " "; y else #g "color blue ; set "; x; " "; y
next y
print x
next x
render #g
#g "flush"</lang>
 
output
Ouptut (Produces both character and graphic):[[File:LogansAnt.png|right|graphic]]
<pre style="height: 40ex; overflow: scroll">
## 21
Anonymous user