Problem Solving Mr. Haytock Problem Set #2: The One Ring

For this problem set, complete the following exercises. Note that you must utilize conditionals in your solutions. Be sure that you include a design in outline or pseudo- code format, make your solution as efficient as possible, and document your work with descriptive comments. Write a paragraph of concluding reflections:  Describe the particular challenges you had with the problem set and how you resolved them.  Analyze your solution in regards to efficiency. Count the number of steps your robot would need to take to complete the task in the worst case.

Bilbo the HobBot Bilbo must make his way out of Gollum’s lair. The caves are very dark, and at some points up ahead there are dead ends. If Bilbo goes into a dead end, he will be cornered by Gollum and will meet certain doom. Bilbo must interpret Gollum’s markings to determine whether the dead ends are ahead and to the left, or ahead and to the right. The robot should begin at 1, 2, North, 0. The robot moves two spaces at each choice. A beeper at his feet indicates that the robot should move two spaces and turn left —no beeper indicates that the robot should move two spaces and turn right. There will be three possible places to look for markings. After the caves, the robot must climb the tower of Isengard. The tower is at least 3 units high, but may be as high as 5 units. Have Bilbo retrieve the golden egg at the top and return down the other side. Finally, Bilbo must climb the Stairs of Cirith Ungol, a set of seven stairs. On each stair may be an elven brooch that Bilbo must pick up. Have Bilbo end at the top of the stairs. The solution should run on “ring2.kwld” and “ring3.kwld.”

Extra Credit: Gandalf has gone ahead to show Bilbo the way home. At every step of the way, Gandalf has left a beeper. If Gandalf turned left, then he left two beepers. If he turned right, he left three. Have Bilbo follow the trail home, starting at 1, 3 facing North. There are seven steps on each trail.