From: Neil Smith Date: Mon, 17 Sep 2018 17:47:15 +0000 (+0100) Subject: Tweaked comments X-Git-Url: https://git.njae.me.uk/?p=summerofcode2018soln.git;a=commitdiff_plain;h=0ada5a1833d263689d2f29eabf203a1eb163f84d Tweaked comments --- diff --git a/src/task1/task1-mpc.hs b/src/task1/task1-mpc.hs index a8a3ccb..e2127b6 100644 --- a/src/task1/task1-mpc.hs +++ b/src/task1/task1-mpc.hs @@ -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 diff --git a/src/task1/task1.hs b/src/task1/task1.hs index 071fe68..e7a4f4b 100644 --- a/src/task1/task1.hs +++ b/src/task1/task1.hs @@ -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)