From: Neil Smith Date: Thu, 15 Dec 2016 07:54:10 +0000 (+0000) Subject: Priority queue version working X-Git-Url: https://git.njae.me.uk/?p=advent-of-code-16.git;a=commitdiff_plain;h=e244d245682d465eb3784ac0ac2ba13342628810 Priority queue version working --- diff --git a/advent11p.hs b/advent11p.hs index 6e4e47d..24955b9 100644 --- a/advent11p.hs +++ b/advent11p.hs @@ -106,9 +106,9 @@ candidates agendum closed = newCandidates candidate = current agendum previous = trail agendum succs = legalSuccessors $ successors candidate - -- nonloops = (succs \\ previous) \\ closed - excludable = previous ++ closed - nonloops = filter (\s -> not $ (canonical s) `elem` excludable) succs + -- excludable = previous ++ closed + -- nonloops = filter (\s -> not $ (canonical s) `elem` excludable) succs + nonloops = filter (\s -> not $ (canonical s) `elem` closed) succs newCandidates = map (\a -> (cost a, a)) $ map (\n -> makeAgendum n) nonloops makeAgendum new = Agendum {current = new, trail = (canonical candidate):previous,