Introducing: Karel the Robot

Karel's World
Karel's Capabilities
Karel's Jobs
Karel's Basic Vocabulary

Karel is a robot living in a simple world who can perform simply stated, interesting tasks. Its world is given as a grid of streets that Karel traverses, containing special objects that Karel can sense and manipulate.

Karel's World

is bounded on west and south side by infinitely long walls of solid, inpenetrable neutronium
contains streets (running east-west) and avenues (running north-south)
can contain wall sections fabricated from neutronium in any desired length and pattern
can contain beepers, small plastic cones emitting a quiet beeping noise, on any street corner

Karel's Capabilities

three video cameras focused to detect walls immediatelly to the left, right, and straight ahead
a microphone to hear a beeper but only if he is on the same corner as Karel
mechanical arm to pick up and put down beepers
soundproof beeper-bag (can use the mechanical arm to see if bag contains beepers)

Karel's Jobs

Karel's jobs can be very different. They generally consist of a task of what we want Karel to do, and a situation that describes exactly the current situation of Karel's world (where are walls and beepers, where is Karel, how many beepers are in his beeper-bag etc.) Here is an example:
   
Every morning Karel is awakened in bed when the newspaper - represented by a beeper - is thrown on the front porch of the house. Program Karel to retrieve the paper and bring it back to bed. The newspaper is always thrown to the same spot, and Karel's world, including his bed, is as pictured.

Karel's Basic Vocabulary

move
Karel moves forward one block. He continues to face the same direction. To avoid damage Karel will not move forward when its path is blocked by a wall. Instead, Karel performs an error shutoff.
turnleft
Karel turns by pivoting 90 degrees to the left. He remains on the same street corner.
pickbeeper
Karel picks up exactly one beeper from the corner on which he is standing and puts it in the beeper-bag. If there is no beeper, Karel performs an error shutoff
putbeeper
Karel extracts a beeper from its beeper-bag and places it on the current street corner. If the beeper-bag is empty, Karel performs an error shutoff.
turnoff
Karel turns itself off and is incapable of executing any more instructions. This must be the last instruction in every robot program.

(bgw)