Learning Python: Child's Play with RUR-PLE!

André Roberge, © 2005-2010

Summary of instructions

Reeborg's actions

move()
turn_left()
pick_beeper()
put_beeper()
turn_off()

Tests:

front_is_clear()
left_is_clear()
right_is_clear()
facing_north()
carries_beepers()
on_beeper() # equivalent to: next_to_a_beeper()

Special built-in function:

repeat(function, number_of_times)
# Note that this is equivalent to
for number in range(number_of_times):
    function()

Object-oriented programming:

Reeborg = UsedRobot()
Reeborg.move()
Reeborg.turn_left()
Reeborg.pick_beeper()
Reeborg.put_beeper()
Reeborg.front_is_clear()
Reeborg.left_is_clear()
Reeborg.right_is_clear()
Reeborg.facing_north()
Reeborg.carries_beepers()
Reeborg.on_beeper() # equivalent to: Reeborg.next_to_a_beeper()

Advanced options:

set_trace_style(style=1, colour='sea green')
# Any colour name recognized by wxPython is acceptable
# style is one of [1, 2, 3, 4, 5]
set_delay(time)
# 0 < time < 10 (in seconds)

Reeborg = UsedRobot(avenues=1, streets=1, orient_key = 'E',
                 beepers=0, name='robot', colour='grey')
# orient_key is one of 'E' or 'e', 'W' or 'w', 'S' or 's', 'N' or 'n'.

# Available robot colours are: 'yellow', 
# 'blue', 'light blue', 'purple' and 'green'.  
# Any other colour will result in the default ('grey') to be used.

# Note that a "serial number" may be appended to the
# robot's "name", so that each robot during an entire play/work session
# with rur-ple will have a unique name.

Reeborg.set_trace_style(style=1, colour='sea green') 
Reeborg.set_delay(time)

New and improved robot!

Guido = RefurbishedRobot()  # inherits from UsedRobot

# Additional methods:
Guido.turn_right()
Guido.left_clear()
Guido.right_clear()
Guido.facing_east()
Guido.facing_south()
Guido.facing_west()
Guido.roll_dice(n=6) # random integer between 1 and n.
home