Search code examples
c#artificial-intelligencemaze

How to traverse a maze programmatically when you've hit a dead end


Moving through the maze forward is pretty easy, but I can't seem to figure out how to back up through the maze to try a new route once you hit a dead end without going back too far?


Solution

  • Use backtracking by keeping a stack of previous direction decisions.