Langton's ant: Difference between revisions
Content added Content deleted
Line 1,742: | Line 1,742: | ||
M.savePGM("langton_ant.pgm"); |
M.savePGM("langton_ant.pgm"); |
||
}</lang> |
}</lang> |
||
=={{header|Easyprog.online}}== |
|||
<lang>len f[] 100 * 100 |
|||
func show . . |
|||
color 999 |
|||
move 0 0 |
|||
rect 100 100 |
|||
color 000 |
|||
for r range 100 |
|||
for c range 100 |
|||
if f[r * 100 + c] = 1 |
|||
move c r |
|||
rect 1 1 |
|||
. |
|||
. |
|||
. |
|||
. |
|||
dx[] = [ 0 1 0 -1 ] |
|||
dy[] = [ -1 0 1 0 ] |
|||
func run x y . . |
|||
while x >= 0 and x < 100 and y >= 0 and y < 100 |
|||
b = f[100 * y + x] |
|||
f[100 * y + x] = 1 - b |
|||
d += 1 + 2 * b |
|||
d = d mod 4 |
|||
x += dx[d] |
|||
y += dy[d] |
|||
. |
|||
. |
|||
call run 70 40 |
|||
call show</lang> |
|||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |