summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-12-23 21:48:57 +0100
committertomsmeding <tom.smeding@gmail.com>2019-12-23 21:48:57 +0100
commit0d9dd1ad91df0c33612e412b94ca94306043b694 (patch)
tree0efdb0fb16c7d44fd2915ddab96a22228ded1d86
parent381f6eefb3becaee8da4a3f9900c4b4e90abb355 (diff)
Similarly fix day 20
-rw-r--r--2019/20.hs4
1 files changed, 3 insertions, 1 deletions
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