projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
07af81c
)
Priority queue version working
day11-astar
author
Neil Smith
<neil.git@njae.me.uk>
Thu, 15 Dec 2016 07:54:10 +0000
(07:54 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Thu, 15 Dec 2016 07:54:10 +0000
(07:54 +0000)
advent11p.hs
patch
|
blob
|
history
diff --git
a/advent11p.hs
b/advent11p.hs
index 6e4e47d83d8ca97c9641f7a458a84239baa0bb0d..24955b90358d463d04653f3207e28a8f1db3c28d 100644
(file)
--- a/
advent11p.hs
+++ b/
advent11p.hs
@@
-106,9
+106,9
@@
candidates agendum closed = newCandidates
candidate = current agendum
previous = trail agendum
succs = legalSuccessors $ successors candidate
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,
newCandidates = map (\a -> (cost a, a)) $ map (\n -> makeAgendum n) nonloops
makeAgendum new = Agendum {current = new,
trail = (canonical candidate):previous,