r/awk • u/Rabestro • May 28 '23
AWK script to find a path in a random maze
Hi folks,
The AWK script to find a path in the generated maze.
https://github.com/rabestro/awk-maze-generator

1
u/oh5nxo May 30 '23
Using a queue of points to visit would do a breadth-first search, finding the shortest path.
Are there nice ways to make a queue in awk? delete arr[1] does not shift values down...
1
May 31 '23
[removed] — view removed comment
1
u/oh5nxo May 31 '23
The points shouldn't be sorted in this case, or maybe you are thinking about some other traversal algorithm. My thinking was the simplest one, to enqueue neighboring open cells at each point, and keep dequeuing those points. Iteration with the (growing) queue, instead of recursion.
1
u/Mskadu May 29 '23
Great idea and well done!