Question: program C++ Write an algorithm for playing a robotic version of the treasure hunt game. The treasure hunt game involves players receiving clues that guide
program C++
Write an algorithm for playing a robotic version of the treasure hunt game. The treasure hunt game involves players receiving clues that guide them to other clues, until eventually the last clue leads them to a treasure. For example, at the beginning of the game the players might receive a slip of paper that says go to the big oak tree, at the oak tree they might find another slip of paper that says try swimming, so they go to the swimming pool to look for a third clue, and so forth.
Robots cant read slips of paper, so the clues for a robot treasure hunt are represented by the colors of tiles. Furthermore, robots arent smart enough to think of (or find) oak trees or swimming pools, so every clue in a robot treasure hunt just requires a robot to move one tile in some direction. After doing so, the robot examines the color of the tile it is then standing on to figure out where to go next, and so forth.
Here are the specific rules for interpreting tile colors as clues:
White tile means that the next clue is the tile directly in front of the robot Blue tile means that the next clue is the tile to the robots left Green tile means that the next clue is the tile to the robots right
7.
Black tile means that the robot should move two tiles backward, then continue interpreting clues based on its new heading
Yellow tile is a treasure it marks the end of a part of a treasure hunt
Rules for your algorithm:
Robot can only move forward, turn left, or turn right.
The robot can detect the color of the position it is current on.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
