演算法
迷宮:
The Main Idea
At a higher level, the Wall Follower algorithm consists of these four simple steps:
If you can turn left, do it.
Else (if you can’t turn left), if you can continue going straight, just go straight.
Else (if you can’t do either of the previous steps), if you can turn right, do it.
If you reached a dead end, turn back by turning around (in either direction) 180 degrees.(節錄自Sparki lessons -Maze Solving)
參考: