From: Neil Smith Date: Mon, 13 Dec 2021 20:30:01 +0000 (+0000) Subject: Updated link for day 12 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=ef4c074dbce0727df2b4cf72166c7ad7252d3a29;p=advent-of-code-21.git Updated link for day 12 --- diff --git a/advent12/Main.hs b/advent12/Main.hs index a191524..c022899 100644 --- a/advent12/Main.hs +++ b/advent12/Main.hs @@ -1,5 +1,4 @@ --- Writeup at https://work.njae.me.uk/2021/12/09/advent-of-code-2021-day-8/ - +-- Writeup at https://work.njae.me.uk/2021/12/13/advent-of-code-2021-day-12/ import Data.Text () import qualified Data.Text.IO as TIO @@ -16,7 +15,7 @@ import Data.Set ((\\)) data Path = Path String -- current cave [String] -- caves visited - (S.Set String) -- closed set of small cavees visited + (S.Set String) -- closed set of small caves visited (Maybe String) -- the small cave we've visited twice deriving (Eq, Ord, Show) @@ -24,7 +23,6 @@ type PathSet = S.Set Path type Graph = M.Map String (S.Set String) - main :: IO () main = do text <- TIO.readFile "data/advent12.txt" @@ -72,7 +70,7 @@ extendPath graph (Path current trail visited returned) recordResult :: Path -> PathSet recordResult path@(Path current _ _ _) - | current == "end" = S.singleton path -- (Path current trail visited) + | current == "end" = S.singleton path | otherwise = S.empty isSmall :: String -> Bool