Hi(gh)!
As the original recursive version of the Maze Solver frequently yielded
"Too many nested macros" errors, I started to re-program it in an
iterative fashion. I pretty soon discovered that I had to add a dead end
detection and thus also to keep track of the already travelled path. I
also found out that I had to swap x and y labyrinth coordinates...
But still a strange bug occurs: after running several times into a dead
end (rendition of the last run attached here), the program does not
advance beyond field <22, 1> (marked in the image with a green cross),
although the situation is nowhere different from the short southern dead
end encountered earlier in the path.
To give a better overview about the path taken by algorithm. I added
#warning outputs of the current path counter value as well as of the
current field coordinates; to avoid endless loops, I also limited the
number of macro calls (preliminarily, after debugging, this should not
be necessary anymore).
The main program and the maze data are also attached here.
See you in Khyberspace!
Yadgar
Post a reply to this message
Attachments:
Download 'mazenew_bug.png' (458 KB)
Download 'maze.inc.txt' (3 KB)
Download 'mazesolver_new.pov.txt' (6 KB)
Preview of image 'mazenew_bug.png'
|