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

\"Find a beeper, pick it up, and all the day you\'ll have good luck\" - from an

ID: 3900368 • Letter: #

Question

"Find a beeper, pick it up, and all the day you'll have good luck" - from an ancient Robot nursery rhyme. TASK: Assume that Reeborg is somewhere in a completely enclosed rectangular room that contains one beeper. There are no obstacles within the room. Program Reeborg to find the beeper, pick it up, face south, and turn himself off. r named André was originally hired to write this program. BACK STORY: A programme André had made an outline of a solution and begun coding when he won a six month all expense-paid trip to France and left his job--leaving completion of the program to someone else. You are the someone else. Your job is to finish the program. The still-to-be-completed program is found in SPUB under the name findbeeperStart.py. IMPLEMENTATION NOTES: Use as your source file name "findbeeper py". Do your work in your -oLa directory. Only one turn off may be used in this program and that one must be located in the main routine. Don't forget to include the title line and global comments at the top of your program; be sure the details reflect this assignment. Use comments in front of your functions to clarify the purpose of the function. This is a "Classic Reeborg" assignment: use only the Python technology you learned in items #1 through #17 of the "Reehorg the Robot Programming Summaryhandout. Do NOT use any variables. Do NOT use any compound predicates, that is no ANDs or ORs, because you really don't need them in this assignment. (Also, do NOT use any recursive procedure calls, that is, no functions call themselves.) For your program, you must use André's code as your starting point def main): move to the beeper () pick beeper) face south turn of) # Traverse systematically until stopping on beeper corner def move to the beeper): go to northwest_corner) face south) while not on beeper(): move to_next adjacent street_corner) NOTE: 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 or the lab assistant TEST SITUATIONS: There are three situations (worlds) available in SPUB that you should use in testing your program: findA.wld, findB.wld, and findC.wld. In addition, you should try your program against any relevant test worlds you may wish to create. GRADING: In addition to examining your source code and the execution results obtained by running your program against the three 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. REQUIRED: You are to electronically submit the source program and screenshots of the outcomes obtained from running your program against the three test worlds. Once you are sure your program is working, run your program against findA.wld. When the program has

Explanation / Answer

FindBeeperstart.py

def main():

move_to_the_beeper()

pick_beeper()

face_south()

turn_off()

# Traverse systematically until stopping on beeper corner

def move_to_the_beeper():

go_to_northwest_corner()

face_south()

while not on_beeper():

move_to_next_adjacent_street_corner()

# Go to room's northwest street corner

def go_to_northwest_corner():

pass # replace and complete the function

# Advance forward to a wall

def move_to_wall():

while front_is_clear():

move()

  

# Move to next adjacent street corner

def move_to_next_adjacent_street_corner():

pass # replace and complete the function

# Move east to adjacent avenue corner

def move_one_avenue_east():

pass # replace and complete the function

  

# Face Reeborg north

def face_north():

while not facing_north():

turn_left()

  

# Face Reeborg south

def face_south():

while not facing_south():

turn_left()

  

# Pivot 90 degrees to the right

def turn_right():

for x in range(3):

turn_left()

# Call the main function.

main()

FindA.Wld

avenues = 10

streets = 10

robot = (5, 3, 'E', 0)

walls = [

(4, 13),

(4, 11),

(4, 9),

(4, 7),

(5, 4),

(7, 4),

(9, 4),

(11, 4),

(13, 4),

(14, 5),

(14, 7),

(14, 9),

(14, 11),

(14, 13),

(11, 14),

(13, 14),

(9, 14),

(7, 14),

(5, 14),

(4, 5)

]

beepers = {

(4, 6): 1

}

findB.Wld

avenues = 10

streets = 10

robot = (3, 4, 'S', 0)

walls = [

(4, 13),

(4, 11),

(4, 9),

(4, 7),

(5, 4),

(4, 5),

(4, 15),

(4, 17),

(6, 17),

(5, 18),

(6, 15),

(6, 13),

(6, 11),

(6, 9),

(6, 7),

(6, 5)

]

beepers = {

(3, 8): 1

}

findC.Wld

avenues = 10

streets = 10

robot = (6, 8, 'S', 0)

walls = [

(3, 18),

(5, 18),

(7, 18),

(9, 18),

(11, 18),

(13, 18),

(14, 17),

(14, 15),

(14, 13),

(13, 12),

(11, 12),

(9, 12),

(7, 12),

(5, 12),

(3, 12),

(2, 13),

(2, 15),

(2, 17)

]

beepers = {

(7, 9): 1

}