Karel Language Reference
Primitives
-
void movek() - Move Karel one intersection
forward.
-
void turnLeft() - Pivots Karel 90 degrees
left.
-
void pickBeeper() - Take a beeper from the
current intersection and put it in the beeper bag.
-
void putBeeper() - Take a beeper from the
beeper bag and put it at the current intersection.
-
void turnOn(char* path) - Turn Karel on.
-
void turnOff() - Turn Karel off.
Sensors
-
int frontIsClear() - 1 if there is no
wall directly in front of Karel. 0 if there is.
-
int frontIsBlocked() - 1 if there is a
wall directly in front of Karel. 0 otherwise.
-
int leftIsClear() - 1 if there is no
wall immediately to Karel's left. 0 if there is.
-
int leftIsBlocked() - 1 if there is a
wall immediately to Karel's left. 0 otherwise.
-
int rightIsClear() - 1 if there is no
wall immediately to Karel's right. 0 if there is.
-
int rightIsBlocked() - 1 if there is a
wall immediately to Karel's right. 0 otherwise.
-
int beepersPresent() - 1 if Karel is
standing at an intersection that has a beeper. 0 otherwise.
-
int noBeepersPresent() - 1 if there
is not beeper at the current intersection. 0 if there is a
beeper at the current intersection.
-
int facingNorth() - 1 if Karel is
facing north. 0 otherwise.
-
int notFacingNorth() - 1 if Karel is not
facing north. 0 if he is facing north.
-
int facingSouth() - 1 if Karel is facing
south. 0 otherwise.
-
int notFacingSouth() - 1 if Karel is not
facing south. 0 if he is facing south.
-
int facingEast() - 1 if Karel is facing
east. 0 otherwise.
-
int notFacingEast() - 1 if Karel is not
facing east. 0 if he is facing east.
-
int facingWest() - 1 if Karel is facing
west. 0 otherwise.
-
int notFacingWest() - 1 if Karel is not
facing west. 0 if he is facing west.
-
int beepersInBag() - 1 if there
is at least one beeper in Karel's beeper bag. 0 if the beeper
bag is empty.
-
int noBeepersInBag() - 1 if Karel's
beeper bag is empty. 0 if there is at least one beeper in
the beeper bag.
Misc
-
void setStepDelay(int) - Sets delay of one
Karel's step in miliseconds.
-
loop(int n){commands} - Arithmetic cycle, which will make exactly n iterations.