Karel J. Robot
Introductory Role Play Classroom Activity

Joseph A. Tosh
Computer Science & Mathematic Teacher
Atlantic City High School
Atlantic City, NJ


Dr. David Levine and Dr. Steven Andrianoff of St. Bonaventure University use and advocate role-playing activities in Computer Science instruction. This activity introduces the Karel J. Robot program (by Joseph Bergin, Mark Stehlik, Jim Roberts, and Richard Pattis) using a role-playing model similar to those promoted by David and Steven.

Background scenario for the role play:

Four robots are directed by four teams of students to maneuver around the room and pick up numbered cards. The group whose robot has a total of exactly eleven points (the sum of the numbers on the cards currently held by the robot) and has "turned off" is declared the winner. The game can continue to decide the 2nd and 3rd place finishers.

Curricular Use:

This is an opening activity to use prior to beginning a unit on Karel J. Robot. It can be used with a class of eight or more students. The activity works best in a standard classroom having desks in rows/columns.

Educational Goals:


This is an enjoyable activity for both the students and the instructor. It encourages interactions between students and with the instructor.

Instructor Preparation Time:

Approximately one hour. (However, the same materials can be used over and over, year after year.)

Classroom Time for completion:

Approximately 40 minutes, (30 to 35 minutes for the game and a 5 to 10 minute debriefing).

Materials Needed:

Materials Preparation:

You will make number cards, name cards and message cards from the paper/index stock.

21 number cards: Draw, (or use a computer and printer), large numbers in the center of the page.

twelve sheets with the number "1"
six with the number "3"
three with the number "5"

4 name cards: each with "Robot", each on a different color paper

24 message cards:

four with "move( )", one on each different color
four with "pickUp( )", one on each different color
four with "putDown(n)", one on each different color
four with "sum( )", one on each different color
four with "turnOff( )", one on each different color
two with "turnLeft( )", on different colors
two with "turnRight( )", on different colors

If you use the plastic page protectors – insert each page into its own protector.
Affix a three foot (3') long piece of twine/string/yarn to the two top corners of the "Robot" cards. This will enable these cards to be hung around the neck of the students portraying robots.

Instructor Notes:

The instructor should have a sheet with the Rules of Play (see below) and a list of the order of play between the teams. The best order of play between the teams would be as follows; given four teams (A, B, C, & D): A B C D, D A B C, C D A B, B C D A, repeat throughout the game. The instructor facilitates the order of play and monitors the accuracy of the moves.

Initial Set Up:

The instructor selects four students to portray the “robots”. The "robots" are asked to follow their team's instructions exactly as they are announced and not to offer any additional movement or information. The remainder of the class is divided into four groups, relatively equal in size. Each group is assigned one "robot," given a deck of message cards and directed to stand in a corner of the room. The robots begin in the corner of the room diagonally across from the team directing their movement. The instructor places the number cards, face down, randomly around the room on top of desks in piles of one, two or three. The piles of number cards should be relatively equally divided among various desks in the middle three rows. The order of the numbers in each pile should also be random.

Rules of Play:

Each team, in turn, is to announce one message to their robot per turn. The messages are found on their deck of message cards; move( ), turnLeft( ) or turnRight( ), pickUp( ), putDown(n), sum( ), and turnOff( ). The messages should be announced preceded by the robots name; such as Chris turnLeft( ), etc.

Any illegal message such as pickUp( ) when the robot is not directly in front of a pile of number cards, or turnOff( ) when their robots sum does not equal eleven, or a move when a robot is facing a wall or desk results in a penalty of missing their next move. You probably don't want to consider it an error, but insist that each message is sent to a robot by name. Tell the robots beforehand not to respond to messages not preceded by their own name.

Follow Up:

Feel free to borrow any portion of this activity however please include a notation of authorship. Send any comments or suggestions for modification to Joe Tosh at jtosh@achigh.acboe.org.


There are some things that should probably be stressed in the debrief after the activity.

Notes (Joseph Bergin)

Instructors should note that the instructions (messages) here are extensions of the Karel J. Robot programming language. That doesn't lessen its usefulness, but make sure that your students aren't confused by this.

You can read more about Role Play to introduce object-oriented programming concepts in:
and in


While the above are Joe Tosh's ideas, note that I (Joe Bergin) added a few things to it. Most were simple edits and clarifications. The debrief suggestions are mine. I hope they are true to the spirit of what Joe intends.

Last Updated: March 1, 2003