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

André Roberge, © 2005

What is RUR-PLE
Summary of instructions
Acknowledgements
About the browser

What is RUR-PLE

Simply put, RUR-PLE is a Python Learning Environment. With the assistance of a robot named Reeborg , we will explore the fun of programming in the Python language. But first, a little bit of background:

The word ‘robot’ entered our language through the 1920 play R.U.R. (Rossum’s Universal Robots) by Czech writer Karel Capek. Little did Capek know how widespread the word would become!

Karel Capek’s name cropped up in 1981, when Richard Pattis wrote a delightful little book titled Karel the Robot, a Gentle Introduction to the Art of Programming. In this book, Pattis introduces the main concepts of sequential programming (including loops and decisions, but not variable assignments) using the paradigm of instructing a robot capable of only four basic actions (turning left, moving one step forward, picking up and putting down beepers). Through the magic of programming, the robot learns to combine those four basic actions in order to accomplish tasks of increasing complexity. Pattis used Pascal, the preferred language of the day, as a means of "teaching" the robot new tricks. Since then, many new versions of Karel the Robot have appeared, used to introducing various computer languages, notably Java and C++, which are both based on the modern Object-Oriented Programming (OOP) approach.

However, since the complexity of Java and C++ contrasts with the simplicity of the robot world, these languages seem at odds with the idea of providing a Gentle Introduction to the Art of Programming.

Enter Python!... Named after the famous Monty Python's Flying Circus by its creator, Guido van Rossum. Python, like Java and C++, is an OOP language. However Python also allows a non-OOP programming style more suitable for interacting with Pattis's robot. A first implementation of Karel the Robot in Python was called PyKarel. The current implementation is called Guido van Robot (GvR for short), and is available at sourceforge.net.

RUR: a Python Learning Environment (rur-ple) is a "new and improved" version of GvR that extends Pattis' ideas and allows a smooth transition to the use of variables as well as functions/methods, classes and objects. Rur-ple is a complete environment, its lessons cover the use of all of Python's keywords. A Python interpreter and simple editor are included to explore Python outside the robot's world.

Reeborg is a robot built on the 1981 Pattis' model ... and it is starting to show its age. It has an oil leak, which allows us to follow its trail. Its compass is broken; it only knows if it is facing North or not, unlike Karel or Guido who could determine their orientation with respect to all four cardinal points.

Pattis' Karel the Robot was named after the author Karel Capek, who popularized the word robot in his play Rossum's Universal Robots (RUR). While rur-ple shares the basic RUR acronym, in this case it stands for Roberge's Used Robot. However, through the magic of Guido van Rossum's Python, you can learn how to fix it and design a better one, worthy of the name Rossum's Universal Robot.

Summary of instructions
Robot actions:
move()
turn_left()
pick_beeper()
put_beeper()
turn_off()
Tests:
front_clear()
facing_North()
carries_beepers()
next_to_a_beeper()
Special built-in function:
repeat(function, number_of_times)
# equivalent to
# for i in range(number_of_times):
#    function()
Object-oriented programming:
Reeborg = UsedRobot()
Reeborg.move()
Reeborg.turn_left()
Reeborg.pick_beeper()
Reeborg.put_beeper()
Reeborg.front_clear()
Reeborg.facing_North()
Reeborg.carries_beepers()
Reeborg.next_to_a_beeper()
Advanced options:
set_trace_style(style=1, colour='sea green')
set_delay(time)
Reeborg =  UsedRobot(avenues=1, streets=1, orient_key = 'E',
                 beepers=0, name = 'Reeborg', colour = 'grey')
Reeborg.set_trace_style(style=1, colour='sea green')
Reeborg.set_delay(time)
New and improved robot (future version)
Guido = RefurbishedRobot()  # inherits from UsedRobot
Guido.turn_right()
Guido.left_clear()
Guido.right_clear()
Guido.facing_East()
Guido.facing_South()
Guido.facing_West()
Acknowledgements

Without my children, Julien and Evelyne, this program would never have been created. This program is dedicated to them, in the hope that they will learn the basics of programming by having fun with it. I must also thank Julien for having designed the splash screen as well as the robot image used in the various error dialogs.

I personally have learned much by writing this program - in fact, I had known about Python only for a few months before I embarked on this project and had not programmed for more years than I care to admit. Of course, without the work done by the Python and wxPython community, the learning curve for me would have been much steeper and this program would not have been possible. This program was inspired by Guido van Robot (GvR), a Python-like implementation of Pattis' original Karel the Robot. I have received very useful comments from the GvR team; in particular, I would like to acknowledge the contribution of Stas Zykiewicz, who taught me a great deal about wxPython, and never tired of trying out buggy code I wrote.Thanks Stas!

Some of the summary pages on Python operators, built-in functions, etc. as well as some program examples have been adapted from [http://granite.sru.edu/~conlon/]. I would like to thank Dr. Michael Conlon for his permission to use this material. [NOTE: This material will likely only be included in version 1.0]

Many of the images for buttons have been adapted from the Nuvola icon set, created by David Vignoni. I wish I could create images as esthetically pleasing as Vignoni does.

This program is hosted on sourceforge.net

home
../images/SourceForge.net Logo