From 0d9dd1ad91df0c33612e412b94ca94306043b694 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 23 Dec 2019 21:48:57 +0100 Subject: Similarly fix day 20 --- 2019/20.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/2019/20.hs b/2019/20.hs index 8deb4e8..1f51c46 100644 --- a/2019/20.hs +++ b/2019/20.hs @@ -23,7 +23,9 @@ shortestPath nextf heuristic startnode target = go 0 (Set.singleton (heuristic s visited' = Map.insert node dist visited in if node == target then dist - else go (ctr + 1) pqueue' visited' + else if maybe True (dist <) (Map.lookup node visited) + then go (ctr + 1) pqueue' visited' + else go (ctr + 1) newpqueue visited main :: IO () main = do -- cgit v1.2.3-70-g09d2