A simple program that relies on random turns and moves to find the exit from a maze. Checks for the presence of a wall in front and moves only if there is none present. Example of Look before you leap.
G = RefurbishedRobot()
G.set_delay(0) # moving as fast as possible
while True:
if G.front_is_clear():
G.move()
if G.next_to_a_beeper():
G.turn_off()
r = G.roll_dice()
if r in [1, 2]:
G.turn_left()
elif r in [3, 4]:
G.turn_right()
We have set the time delay to the minimum value (hence, the fastest speed) as it can take
quite a while to find the exit! The example below is not necessarily representative.

A simple program that relies on random turns and moves to find the exit from a maze. Catches exceptions (rather than checking for the presence of a wall). Example of Better to ask forgiveness than permission.
G = RefurbishedRobot()
G.set_delay(0) # moving as fast as possible
while True:
try:
G.move()
if G.next_to_a_beeper():
G.turn_off()
except HitWallException:
pass
r = G.roll_dice(3) # possible values: 1, 2, 3
if r == 1:
G.turn_left()
elif r == 2:
G.turn_right()