Karel Language Reference
Primitives
- void step()- Moves Karel one intersection forward
- void turn_left()- Pivots Karel 90 degrees left
- void pick_beeper()- Takes a beeper from the current intersection and puts it in the beeper bag
- void put_beeper()- Takes a beeper from the beeper bag and puts it at the current intersection
- void turn_on(char* path)- Turns Karel on
- void turn_off()- Turns Karel off
Sensors
- bool front_is_clear()- Returns- trueif there is no wall directly in front of Karel. Returns- falseif there is a wall.
- bool beepers_present()- Returns- trueif Karel is standing at an intersection that has a beeper,- falseotherwise
- bool facing_north()- Returns- trueif Karel is facing north,- falseotherwise
- bool beepers_in_bag()- Returns- trueif there is at least one beeper in Karel's beeper bag,- falseif the beeper bag is empty
Misc
- void set_step_delay(int)- Sets delay of one Karel's step in miliseconds
Super Karel Language Reference
Super Karel is an extension to the basic Karel the Robot library. Super Karel is "equipped" with additional sensors.
Sensors
- bool front_is_blocked()- Returns- trueif there is a wall directly in front of Karel,- falseotherwise.
- bool left_is_clear()- Returns- trueif there is no wall immediately to Karel's left,- falseif there is
- bool left_is_blocked()- Returns- trueif there is a wall immediately to Karel's left,- falseotherwise
- bool right_is_clear()- Returns- trueif there is no wall immediately to Karel's right,- falseif there is
- bool right_is_blocked()- Returns- trueif there is a wall immediately to Karel's right,- falseotherwise
- bool no_beepers_present()- Returns- trueif there is not beeper at the current intersection,- falseif there is a beeper at the current intersection
- bool not_facing_north()- Returns- trueif Karel is not facing north,- falseif he is facing north
- bool facing_south()- Returns- trueif Karel is facing south,- falseotherwise
- bool not_facing_south()- Returns- trueif Karel is not facing south,- falseif he is facing south
- bool facing_east()- Returns- trueif Karel is facing east,- falseotherwise
- bool not_facing_east()- Returns- trueif Karel is not facing east,- falseif he is facing east
- bool facing_west()- Returns- trueif Karel is facing west,- falseotherwise
- bool not_facing_west()- Returns- trueif Karel is not facing west,- falseif he is facing west
- bool no_beepers_in_bag()- Returns- trueif Karel's beeper bag is empty,- falseif there is at least one beeper in the beeper bag
Library
Here you can find the original library of Karel the Robot, including the library installation instructions.
Karel's World
- Text file with .kw extension
- Example of the first line: 7 3 1 2 E 5- 7 3 - World dimensions (first horizontal, second vertical)
- 1 2 - Position of Karel the Robot in the beginning of your program (first horizontal, second vertical)
- E - Direction of Karel the Robot in the beginning of your program
- 5 - Number of beepers in Karel's bag in the beginning of your program
 
- Any other line starting with B represents beeper(s) placed in the world, example: B 5 1 2- B - This is beeper data
- 5 1 - Position in the world (first horizontal, second vertical)
- 2 - Number of beepers placed in this position
 
- Any other line starting with W represents wall, example: W 5 1 E- W - This is wall data
- 5 1 - Position in the world (first horizontal, second vertical)
- E - Direction to which the wall is placed from the given position (because walls are placed between particular positions)