Anonymous user
Langton's ant: Difference between revisions
→{{header|Run BASIC}}
(→{{header|Scala}}: Provide more details on incorrectness.) |
|||
Line 2,415:
<lang Runbasic>dim plane(100,100)
x = 50: y = 50
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)
maxY = max(y,maxY) ' highest y to prevent printing blank lines
wend
graphic #g, 100,100
for y =
for x = 1 to 100
print chr$((plane(x,y)*3) + 32);
Line 2,442:
next y
render #g
#g "flush""</lang>
Ouptut (Produces both character and graphic):[[File:Langtons_ant_run_basic.png|right|graphic]]
<pre style="height: 40ex; overflow: scroll"> 20
|