Search code examples
pseudocodemaze

What should be the appropriate pseudo-code of the following maze?


From o> reach E

Puzzle is: From o> reach E.

I'm trying to solve the following maze with the help of the choices on the left but I'm not able to figure out how.


Solution

  • To solve that particular maze is fairly simple, consisting of four instances of move forward, a turn right, five more move forward steps, another turn right, and so on.

    However, assuming you're looking for a more general solution, you can often solve a maze by hugging one side (left or right, it rarely matters).

    Such an algorithm can be easily built up from the steps provided to first find both keys (ignoring doors) then, once that's done, keep going with the same scheme (hug one wall), detecting and opening the doors as they become available.