Maze solving: Difference between revisions

m
Line 1,491:
#
call make_maze
call show_maze</lang>
#
func mark pos col . .
x = pos mod n
y = pos div n
set_color col
move_pen x * f + f / 4 y * f + f / 4
draw_circle f / 4
.
func solve dir0 pos . found .
call mark pos 900
sleep 0.05
if pos = endpos
found = 1
else
for dir range 4
posn = pos + offs[dir]
if dir <> dir0 and m[posn] = 0 and found = 0
call solve (dir + 2) mod 4 posn found
if found = 0
call mark posn 777
sleep 0.05
.
.
.
.
.
sleep 3
call solve -1 startpos found</lang>
 
=={{header|EGL}}==
1,983

edits