never executed always true always false
1 module HelVM.HelMA.Automata.Piet.Types.DirectionPointer (
2 addCoordinates,
3 rotate,
4 DirectionPointer(..),
5 ) where
6
7 import HelVM.HelMA.Automata.Piet.Types.Coordinates
8 import HelVM.HelMA.Automata.Piet.Types.Extra
9
10 addCoordinates :: DirectionPointer -> Coordinates -> Coordinates
11 addCoordinates DPRight (x, y) = (x + 1, y)
12 addCoordinates DPDown (x, y) = (x, y + 1)
13 addCoordinates DPLeft (x, y) = (x - 1, y)
14 addCoordinates DPUp (x, y) = (x, y - 1)
15
16 rotate :: Int -> DirectionPointer -> DirectionPointer
17 rotate = change 4
18
19 data DirectionPointer = DPRight | DPDown | DPLeft | DPUp
20 deriving stock (Show, Read, Eq, Ord, Enum, Bounded)