Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

BACKGROUND: Reeborg likes to take long meandering walks in his world. On one suc

ID: 3906122 • Letter: B

Question

BACKGROUND: Reeborg likes to take long meandering walks in his world. On one such walk he discovered a map showing the way to some treasure. Reeborg is puzzled as to how to follow the clues and needs help from a programmer TASK: Program Reeborg to follow the clues on the treasure map. When Reeborg reaches his destination (you know, "X marks the spot") he should pick up the beepers there, then turn to the north and turn himself off. (Obviously to wait for the truck carrying his team of excavators to arrive.) SITUATION DETAILS: The clues on Reeborg's map consist of pairs of clue corners. With one exception, the direction clue corner has from 1 to 4 beepers on it and indicates which direction Reeborg should go to find the next clue. The directions are encoded as: East-1, North 2, West-3, South-4 beepers. The distance clue corner is somewhere adjacent to the direction clue corner. By adjacent we will mean either immediately above or below or to either side of the direction clue corner, diagonal comers can be disregarded. The number of beepers on this distance corner indicate how far Reeborg must pace to the next clue from the position of the direction clue corner. While following the directions, Reeborg will not be presented with any obstacles directly on his path. However, there may well be wall sections cluttered around the direction clue corner that might make finding the distance clue corner interesting". Reeborg will start each task sitting on a direction clue corner. The destination "X") is a direction clue comer that has five beepers on it. (Five beepers is obviously a sentinel value.) With the exception of the final five beepers, that Reeborg should take as a momento of his journey, Reeborg MUST leave each corner with the SAME number of beepers as were there originally IMPLEMENTATION NOTES: As usual, only one turn off) may be used and that one must be located in the main routine. Do NOT use any recursive procedure calls, that is no functions call themselves. If you wish, you may use compound predicates in this program. You WILL need to use variables in this program. (But do not use any global variables.) This assignment is meant to exercise YOUR skills in using value-returning functions and YOUR understanding of passing data to functions using arguments and parameters. When your program is completed, draw a hierarchy chart and using that as a guide hierarchica arrange the order of functions within your source file (with your main) function first); you will not be asked to turn in your hierarchy chart for this assignment. Use as your source file name "treasure-py". There is no starter file for this However to save time, feel free to copy and make use of the beepers on corner0 and move forward0 functions developed in lecture; either type them in from your lecture notes or they can be lifted from the file SPUBluckywalk.py signment TEST SITUATIONS: There are two situations (worlds) being provided to you to test your program: treasureA.wld and treasureB.wld. These can be copied from SPUB GRADING: In addition to examining your source code and the execution results obtained by running your program against the two situations above, the grader may run your program against some additional (and unknown to you) situations. Your program must complete the task under ALL legal initial situations to be considered correct. Also remember this assignment is meant to exercise YOUR ability to think; neither offer nor accept any additional help, except on a one-to-one basis with the instructor

Explanation / Answer

The code I am posting is standard code, and this is standard problem.

Hope it helps