never executed always true always false
1 module HelVM.HelMA.Automata.Piet.Types.Orientation (
2 rotateDirectionPointer,
3 toggleCodelChooser,
4 rotateToggle,
5 initialOrientation,
6 Orientation(..),
7 ) where
8
9 import HelVM.HelMA.Automata.Piet.Types.CodelChooser
10 import HelVM.HelMA.Automata.Piet.Types.Coordinates
11 import HelVM.HelMA.Automata.Piet.Types.DirectionPointer
12
13 rotateDirectionPointer :: Int -> Orientation -> Orientation
14 rotateDirectionPointer n o = o { directionPointer = rotate n (directionPointer o)}
15
16 toggleCodelChooser :: Int -> Orientation -> Orientation
17 toggleCodelChooser n o = o { codelChooser = toggle n (codelChooser o)}
18
19 rotateToggle :: Coordinates -> Orientation -> Orientation
20 rotateToggle (r, t) (Orientation dp cc) = Orientation (rotate r dp) (toggle t cc)
21
22 initialOrientation :: Orientation
23 initialOrientation = Orientation DPRight CCLeft
24
25 data Orientation = Orientation
26 { directionPointer :: !DirectionPointer
27 , codelChooser :: !CodelChooser
28 }