Tweaked comments
authorNeil Smith <neil.git@njae.me.uk>
Mon, 17 Sep 2018 17:47:15 +0000 (18:47 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Mon, 17 Sep 2018 17:47:15 +0000 (18:47 +0100)
src/task1/task1-mpc.hs
src/task1/task1.hs

index a8a3ccbba0e00b22dafa6129764285c140e14a68..e2127b6d20467cf5feab7f163267284209f89b52 100644 (file)
@@ -16,13 +16,15 @@ import qualified Control.Applicative as CA
 
 -- 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)
@@ -99,6 +101,8 @@ symb = L.symbol sc
 
 -- instructions is some optional space followed by many instructions
 instrsP = optional sc *> many instrP
+
+-- an instruction is either F, C, or A
 instrP = forwardP <|> cwP <|> acwP
 
 -- parse each instruction
index 071fe68f3d1310f88b1f35e42c83cbee92e9ae41..e7a4f4bacf3770fe7192a9296eaa84dafa58b2a1 100644 (file)
@@ -2,13 +2,15 @@ import Data.List (foldl')        -- import the strict fold
 
 -- 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)