-- number of steps
type Distance = Int
+
+-- easting, northing
type Position = (Int, Int)
-- the directions. See below for functions for turning
data Direction = North | East | South | West
deriving (Enum, Show, Bounded, Eq)
--- direction, easting, northing
+-- the currenct state of a Mowmaster
data Mowmaster = Mowmaster { direction :: Direction
, position :: Position
} deriving (Show, Eq)
readInstruction' _ t = Comment t
-initialMowmaster = Mowmaster North (0, 0)
+initialMowmaster = Mowmaster East (0, 0)
-- Calculate manhattan distance from start to this state
-- Move in the current direction
-forward :: Int -> Direction -> Position -> Position
+forward :: Distance -> Direction -> Position -> Position
forward s North (e, n) = (e, n+s)
forward s South (e, n) = (e, n-s)
forward s West (e, n) = (e-s, n)