2.7 KiB
2.7 KiB
Karel Language Reference
Primitives
step :: Karel -> Karel
Moves Karel one intersection forwardturnLeft :: Karel -> Karel
Pivots Karel 90 degrees leftpickBeeper :: Karel -> Karel
Takes a beeper from the current intersection and puts it in the beeper bagputBeeper :: Karel -> Karel
Takes a beeper from the beeper bag and puts it at the current intersection
Sensors
frontIsClear :: Karel -> Bool
ReturnsTrue
if there is no wall directly in front of Karel. ReturnsFalse
if there is a wall.beepersPresent :: Karel -> Bool
ReturnsTrue
if Karel is standing at an intersection that has a beeper,False
otherwisefacingNorth :: Karel -> Bool
ReturnsTrue
if Karel is facing north,False
otherwisebeepersInBag :: Karel -> Bool
ReturnsTrue
if there is at least one beeper in Karel's beeper bag,False
if the beeper bag is empty
Super Karel Language Reference
Super Karel is an extension to the basic Karel the Karel library. Super Karel is "equipped" with additional sensors.
Sensors
frontIsBlocked :: Karel -> Bool
ReturnsTrue
if there is a wall directly in front of Karel,False
otherwise.leftIsClear :: Karel -> Bool
ReturnsTrue
if there is no wall immediately to Karel's left,False
if there isleftIsBlocked :: Karel -> Bool
ReturnsTrue
if there is a wall immediately to Karel's left,False
otherwiserightIsClear :: Karel -> Bool
ReturnsTrue
if there is no wall immediately to Karel's right,False
if there isrightIsBlocked :: Karel -> Bool
ReturnsTrue
if there is a wall immediately to Karel's right,False
otherwiseno_beepers_present :: Karel -> Bool
ReturnsTrue
if there is not beeper at the current intersection,False
if there is a beeper at the current intersectionnotFacingNorth :: Karel -> Bool
ReturnsTrue
if Karel is not facing north,False
if he is facing northfacingSouth :: Karel -> Bool
ReturnsTrue
if Karel is facing south,False
otherwisenotFacingSouth :: Karel -> Bool
ReturnsTrue
if Karel is not facing south,False
if he is facing southfacingEast :: Karel -> Bool
ReturnsTrue
if Karel is facing east,False
otherwisenotFacingEast :: Karel -> Bool
ReturnsTrue
if Karel is not facing east,False
if he is facing eastfacingWest :: Karel -> Bool
ReturnsTrue
if Karel is facing west,False
otherwisenotFacingWest :: Karel -> Bool
ReturnsTrue
if Karel is not facing west,False
if he is facing westnoBeepersInBag :: Karel -> Bool
ReturnsTrue
if Karel's beeper bag is empty,False
if there is at least one beeper in the beeper bag