[Python] cs1robots python module: Robot won't turn

Discussão em 'Python' iniciado por Stack, Maio 14, 2025.

  1. Stack

    Stack Membro Participativo

    I have been trying to solve the rain2.wld file in the cs1robots module. here is the code:

    from cs1robots import *

    load_world("rain2")
    h = Robot(avenue=3, street=6, orientation='S', beepers=10)
    h.set_trace("blue")
    h.set_pause(0.3)

    h.drop_beeper()
    h.move()

    while not h.on_beeper():
    if h.right_is_clear():
    h.drop_beeper()
    h.move()
    elif h.front_is_clear():
    h.move()
    elif h.left_is_clear():
    h.turn_left()



    output of the code

    i wanted it to check for every "window" and place a beeper there. but this is not doing it.

    This is the output that i am going for is: planned output

    Continue reading...

Compartilhe esta Página