Add public interface

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2020-11-08 16:13:53 +01:00
parent 0033f1f9ce
commit 965e6d8f35
No known key found for this signature in database
GPG key ID: DE0CF444096A468D

61
interface.md Normal file
View file

@ -0,0 +1,61 @@
# Karel Language Reference
## Primitives
- `step :: Karel -> Karel`<br>
Moves Karel one intersection forward
- `turnLeft :: Karel -> Karel`<br>
Pivots Karel 90 degrees left
- `pickBeeper :: Karel -> Karel`<br>
Takes a beeper from the current intersection and puts it in the beeper bag
- `putBeeper :: Karel -> Karel`<br>
Takes a beeper from the beeper bag and puts it at the current intersection
## Sensors
- `frontIsClear :: Karel -> Bool`<br>
Returns `True` if there is no wall directly in front of Karel. Returns `False` if there is a wall.
- `beepersPresent :: Karel -> Bool`<br>
Returns `True` if Karel is standing at an intersection that has a beeper, `False` otherwise
- `facingNorth :: Karel -> Bool`<br>
Returns `True` if Karel is facing north, `False` otherwise
- `beepersInBag :: Karel -> Bool`<br>
Returns `True` 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`<br>
Returns `True` if there is a wall directly in front of Karel, `False` otherwise.
- `leftIsClear :: Karel -> Bool`<br>
Returns `True` if there is no wall immediately to Karel's left, `False` if there is
- `leftIsBlocked :: Karel -> Bool`<br>
Returns `True` if there is a wall immediately to Karel's left, `False` otherwise
- `rightIsClear :: Karel -> Bool`<br>
Returns `True` if there is no wall immediately to Karel's right, `False` if there is
- `rightIsBlocked :: Karel -> Bool`<br>
Returns `True` if there is a wall immediately to Karel's right, `False` otherwise
- `no_beepers_present :: Karel -> Bool`<br>
Returns `True` if there is not beeper at the current intersection, `False` if there is a beeper at the current intersection
- `notFacingNorth :: Karel -> Bool`<br>
Returns `True` if Karel is not facing north, `False` if he is facing north
- `facingSouth :: Karel -> Bool`<br>
Returns `True` if Karel is facing south, `False` otherwise
- `notFacingSouth :: Karel -> Bool`<br>
Returns `True` if Karel is not facing south, `False` if he is facing south
- `facingEast :: Karel -> Bool`<br>
Returns `True` if Karel is facing east, `False` otherwise
- `notFacingEast :: Karel -> Bool`<br>
Returns `True` if Karel is not facing east, `False` if he is facing east
- `facingWest :: Karel -> Bool`<br>
Returns `True` if Karel is facing west, `False` otherwise
- `notFacingWest :: Karel -> Bool`<br>
Returns `True` if Karel is not facing west, `False` if he is facing west
- `noBeepersInBag :: Karel -> Bool`<br>
Returns `True` if Karel's beeper bag is empty, `False` if there is at least one beeper in the beeper bag