never executed always true always false
1 module HelVM.HelMA.Automata.Piet.Types.InstructionCounter (
2 directionPointerIC,
3 codelChooserIC,
4 rotateDirectionPointerIC,
5 toggleCodelChooserIC,
6 initialInstructionCounter,
7 InstructionCounter(..),
8 ) where
9
10 import HelVM.HelMA.Automata.Piet.Types.CodelChooser
11 import HelVM.HelMA.Automata.Piet.Types.Coordinates
12 import HelVM.HelMA.Automata.Piet.Types.DirectionPointer
13 import HelVM.HelMA.Automata.Piet.Types.Orientation
14
15 directionPointerIC :: InstructionCounter -> DirectionPointer
16 directionPointerIC = directionPointer . orientation
17
18 codelChooserIC :: InstructionCounter -> CodelChooser
19 codelChooserIC = codelChooser . orientation
20
21 rotateDirectionPointerIC :: Int -> InstructionCounter -> InstructionCounter
22 rotateDirectionPointerIC n ic = ic { orientation = rotateDirectionPointer n (orientation ic)}
23
24 toggleCodelChooserIC :: Int -> InstructionCounter -> InstructionCounter
25 toggleCodelChooserIC n ic = ic { orientation = toggleCodelChooser n (orientation ic)}
26
27 initialInstructionCounter :: InstructionCounter
28 initialInstructionCounter = InstructionCounter initialCoordinates initialOrientation
29
30 data InstructionCounter = InstructionCounter
31 { position :: !Coordinates
32 , orientation :: !Orientation
33 }