X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent21%2FMain.hs;h=3048dafe31fddacea739847b68029a8c7e7a4192;hb=1ab3e062eb1b3b28a8aead9834afc962ca142451;hp=191530e7a05a21b546b6abfb2167d3501c6aa4d7;hpb=64b373b65e3acb209038196ee9f2b54b97b306fe;p=advent-of-code-21.git diff --git a/advent21/Main.hs b/advent21/Main.hs index 191530e..3048daf 100644 --- a/advent21/Main.hs +++ b/advent21/Main.hs @@ -1,6 +1,6 @@ -- Writeup at https://work.njae.me.uk/2021/12/26/advent-of-code-2021-day-21/ -import Debug.Trace +-- import Debug.Trace import Data.Text () import qualified Data.Text.IO as TIO @@ -113,7 +113,7 @@ mod1 a b = ((a - 1) `mod` b) + 1 -- Parsing -playerP = ("1" *> pure Player1) <|> ("2" *> pure Player2) +playerP = (Player1 <$ "1") <|> (Player2 <$ "2") playerStateP = playerify <$> ("Player " *> playerP) <*> (" starting position: " *> decimal) where playerify name pos = (name, PlayerState {position = pos, score = 0})