46 lines
1,007 B
Haskell
46 lines
1,007 B
Haskell
|
module SuperKarel where
|
||
|
|
||
|
import Karel
|
||
|
|
||
|
frontIsBlocked :: Karel -> Bool
|
||
|
frontIsBlocked = not . frontIsClear
|
||
|
|
||
|
leftIsClear :: Karel -> Bool
|
||
|
leftIsClear = frontIsClear . turnLeft
|
||
|
|
||
|
leftIsBlocked :: Karel -> Bool
|
||
|
leftIsBlocked = not . leftIsClear
|
||
|
|
||
|
rightIsClear :: Karel -> Bool
|
||
|
rightIsClear = frontIsClear . turnLeft . turnLeft . turnLeft
|
||
|
|
||
|
rightIsBlocked :: Karel -> Bool
|
||
|
rightIsBlocked = not . rightIsClear
|
||
|
|
||
|
noBeepersPresent :: Karel -> Bool
|
||
|
noBeepersPresent = not . beepersPresent
|
||
|
|
||
|
notFacingNorth :: Karel -> Bool
|
||
|
notFacingNorth = not . facingNorth
|
||
|
|
||
|
facingSouth :: Karel -> Bool
|
||
|
facingSouth = (== South) . direction
|
||
|
|
||
|
notFacingSouth :: Karel -> Bool
|
||
|
notFacingSouth = not . facingSouth
|
||
|
|
||
|
facingEast :: Karel -> Bool
|
||
|
facingEast = (== East) . direction
|
||
|
|
||
|
notFacingEast :: Karel -> Bool
|
||
|
notFacingEast = not . facingEast
|
||
|
|
||
|
facingWest :: Karel -> Bool
|
||
|
facingWest = (== West) . direction
|
||
|
|
||
|
notFacingWest :: Karel -> Bool
|
||
|
notFacingWest = not . facingWest
|
||
|
|
||
|
noBeepersInBag :: Karel -> Bool
|
||
|
noBeepersInBag = not . beepersInBag
|