0% found this document useful (0 votes)
416 views2 pages

Robot Beeper Dropping Algorithm

This document defines functions to control a robot named hubo to drop beepers in a grid world. It creates a 7x7 world and initializes hubo with 36 beepers. Functions are defined to move hubo forward while dropping beepers, turn right, move up one space, and move up and to the right. The main drop_all function calls the other functions to have hubo drop beepers in a grid pattern.

Uploaded by

Hanan Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
416 views2 pages

Robot Beeper Dropping Algorithm

This document defines functions to control a robot named hubo to drop beepers in a grid world. It creates a 7x7 world and initializes hubo with 36 beepers. Functions are defined to move hubo forward while dropping beepers, turn right, move up one space, and move up and to the right. The main drop_all function calls the other functions to have hubo drop beepers in a grid pattern.

Uploaded by

Hanan Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Problem 9:plant 1

from cs1robots import *

Create_world(avenues=7,streets=7)

hubo=Robot(beepers=36)

hubo.set_trace("blue")

hubo.set_pause(0.2)

hubo.move()

def drop_move():

for i in range(6):

not hubo.on_beeper():

hubo.drop_beeper()

else:

hubo_front_is_clear():

hubo.move()

def turn_right():

for i in range(3):

hubo.turn_left()

def go_up():

hubo.turn_left()

hubo.move()

hubo.turn_left()

def go_upright():

turn_right()

hubo.move()

turn_right()
def drop_all():

for i in range(2)

drop_move()

go_up()

drop_move()

go_upright()

drop_all

drop_move()

go_up()

drop_move()

You might also like