Karel the Robot – Quick-Start User Guide

1. What Is Karel?

Karel lives in a 2-D grid (“world”) of square cells. He can face North/East/South/West, move one cell at a time, pick up or put down “beepers,” and detect walls.

2. Simulator Interface

3. Syntax Essentials

4. Built-in Commands

Movement

CommandEffect
move()Step forward if no wall ahead.
turnLeft()Rotate 90° counter-clockwise.

Beeper Handling

CommandEffect
pickBeeper()Pick one beeper from current cell.
putBeeper()Place one beeper into current cell.

Sensors & Conditions

ConditionTrue When…
frontIsClear()No wall immediately in front.
frontIsBlocked()Wall immediately in front.
leftIsClear()No wall on Karel’s left.
leftIsBlocked()Wall on Karel’s left.
rightIsClear()No wall on Karel’s right.
rightIsBlocked()Wall on Karel’s right.
nextToABeeper()One or more beepers in this cell.
notNextToABeeper()No beepers in this cell.
facingNorth(), facingEast(), … Karel’s orientation matches the named direction.
anyBeepersInBeeperBag()Bag contains ≥ 1 beeper.
noBeepersInBeeperBag()Bag is empty.

5. Example

while ( notNextToABeeper() ) {
  move();
}
pickBeeper();
turnLeft();
move();
putBeeper();

6. Tips

← Back to Simulator