aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/02/solver.el
diff options
context:
space:
mode:
Diffstat (limited to 'AoC2022/02/solver.el')
-rw-r--r--AoC2022/02/solver.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/AoC2022/02/solver.el b/AoC2022/02/solver.el
index 62dd554..66fa308 100644
--- a/AoC2022/02/solver.el
+++ b/AoC2022/02/solver.el
@@ -9,7 +9,7 @@
;; Version: 0.0.1
;; Keywords: abbrev bib c calendar comm convenience data docs emulations extensions faces files frames games hardware help hypermedia i18n internal languages lisp local maint mail matching mouse multimedia news outlines processes terminals tex tools unix vc wp
;; Homepage: https://github.com/titan/solver
-;; Package-Requires: ((emacs "25.1"))
+;; Package-Requires: ((emacs "27.1"))
;;
;; This file is not part of GNU Emacs.
;;
@@ -71,10 +71,21 @@
(with-temp-buffer
(insert-file-contents "input")
(goto-char 0)
+ ;; Equivalent forms to incrementally read.
+ ;; Probe end of file
(cl-loop while (not (looking-at (rx (* whitespace) eot)))
for oponent = (solver-translate (read (current-buffer)))
for my-game = (funcall strategy oponent (read (current-buffer)))
- sum (+ (solver-weight my-game) (solver-result-a my-game oponent)))))
+ sum (+ (solver-weight my-game) (solver-result-a my-game oponent)))
+ ;; Let it crash and recover last
+ ;; (let ((total 0))
+ ;; (ignore-error end-of-file
+ ;; (while t
+ ;; (let* ((oponent (solver-translate (read (current-buffer))))
+ ;; (my-game (funcall strategy oponent (read (current-buffer)))))
+ ;; (cl-incf total (+ (solver-weight my-game) (solver-result-a my-game oponent))))))
+ ;; total)
+ ))
(ert-deftest solver-results ()
(should (= 12535 (solver-parse #'solver-fixed-plays)))