Karel the Robot A Gentle Introduction to the

Karel the Robot A Gentle Introduction to the Art of Object. Oriented Programming in Java

Who is Karel? n Karel is actually a very nice, gentle introduction into Java. n And a lot of the concepts that we learn, sort of software engineering concepts using Karel, will translate over to the Java world.

Who is Karel? n The term, "Karel" actually comes from Karel Capek. He was a Czech playwright who actually wrote a play called, "RUR, " which was about robots. n And the word Robot actually comes from a Czech word, the Czech word for work. And so the robot is named after Karel. n And some people say Karl, which is kind of actually closer to the actual pronunciation.

Schools Using Karel ØStanford ØUC-Berkeley ØU. of Washington ØAir Force Academy ØWestpoint (USMA) ØCarnegie-Mellon ØPurdue

Karel's World n A flat World n Horizontal streets running East-West n Vertical avenues running North-South Intersection 2, 3 Walls

Karel's World n Walls n n impenetrable structures that robots can't get through Beepers n objects which robots can put down, pick up and carry Beepers Walls

Robot Abilities n Move n n move only in the direction it is facing moves one block at a time, from one intersection to the next robot at 2, 3 facing East moves to 2, 4 (still facing East)

Robot Abilities n Turn left n rotate 90 degrees anti-clockwise robot at 2, 4 facing East turns to face North (still at 2, 4)

Robot Abilities n n pick up a beeper put down a beeper Beepers can be picked up or put down at 2, 3

For example, it might look like the figure below on a computer screen.

Walls n Also in Karel’s environment are impenetrable wall sections that can be placed between streets. n Karel can “see” wall sections that are immediately to his front or to his left and right sides.

Wall Sections n Can be used to form a maze that Karel must navigate


Wall Sections …or to represent hurdles that Karel must “jump” in a hurdle race

Karel’s Capabilities n Karel is a mobile robot: he can move forward, in the direction he is facing, and he can turn in place. n Karel possesses rudimentary senses: Sight n Sound n Direction n Touch n

n Karel is equipped with a mechanical arm that he can use to pick up and put down beepers. n To carry these beepers, Karel has a soundproof “beeper bag. ” n Karel can determine if he is carrying any beepers in this bag by probing it with his arm.
- Slides: 16