Langton's ant: Difference between revisions

(→‎{{header|Scala}}: Provide more details on incorrectness.)
Line 2,415:
<lang Runbasic>dim plane(100,100)
x = 50: y = 50
mxminY = 100
 
while (x>0) and (x<100) and (y>0) and (y<100)
if plane(x,y) then
nxt = nxt - 1
if nxt < 1 then nxt = 4
Line 2,424:
nxt = nxt + 1
if nxt > 4 then nxt = 1
end if
 
x = x + (nxt = 2) - (nxt = 4)
plane(x,y) = (plane(x,y) <> 1)
y = y + (nxt = 3) - (nxt = 1)
plane(x,y) = (plane(x,y) <> 1)
x = x + (nxt = 2) - (nxt = 4)
y minY = min(y,minY) = y + (nxt = 3) - (nxt =' find lowest and 1)
maxY = max(y,maxY) ' highest y to prevent printing blank lines
my = min(y,my)
wend
 
graphic #g, 100,100
for y = myminY to 100maxY
for x = 1 to 100
print chr$((plane(x,y)*3) + 32);
Line 2,442:
next y
render #g
#g "flush""</lang>
 
output
Ouptut (Produces both character and graphic):[[File:Langtons_ant_run_basic.png‎|right|graphic]]
<pre style="height: 40ex; overflow: scroll"> 20
Anonymous user