solving a maze
There are many well-known approaches to solving a maze. For this program, you will use a method known as the right-hand rule algorithm. (An algorithm is a set of instructions for solving a problem.) As the TriBot moves through the maze, it will always follow the wall to its right, going through any opening on that side.
The right-hand rule algorithm works for mazes without tunnels or bridges and where the start and end points are at the edges of the maze (this method won’t work for a maze where the goal is to get to the center). As long as the maze fits these criteria, the robot is guaranteed to find the exit.
Figure 7-4 shows an example maze with the path followed using the right-hand rule. To help you understand how this rule works, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access