aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AoC2022/16/solver.lisp9
1 files changed, 4 insertions, 5 deletions
diff --git a/AoC2022/16/solver.lisp b/AoC2022/16/solver.lisp
index 6f0f254..7cf28b6 100644
--- a/AoC2022/16/solver.lisp
+++ b/AoC2022/16/solver.lisp
@@ -110,7 +110,6 @@
;; )
-
(defun advance (graph actor open)
(destructuring-bind (path time-left previous-flow) (car actor)
(let* ((current-options (assoc (car path) graph :test #'=))
@@ -130,14 +129,14 @@
(list (list path 0 current-flow)))
open)
- (arrows:->
+ (reduce (lambda (acc term)
+ (if (>= (accumulated-flow acc) (accumulated-flow term))
+ acc term))
(loop for (node . actor-next-move) in next
collect
(traverse graph
(append (cdr actor) actor-next-move)
- (logior node open)))
- (sort #'>= :key #'accumulated-flow)
- (car))))))
+ (logior node open))))))))
(defun solver (filename start-time actors)
(let* ((action-graph (worthwhile-graph (data filename)))