d692b61fbee1

More test fixes
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 08 Dec 2019 14:50:54 -0500
parents 5f6c2d777533
children ebd2a1bb4889
branches/tags (none)
files src/2016/days/day-05.lisp src/2017/days/day-08.lisp src/2018/days/day-03.lisp

Changes

--- a/src/2016/days/day-05.lisp	Sun Dec 08 13:47:53 2019 -0500
+++ b/src/2016/days/day-05.lisp	Sun Dec 08 14:50:54 2019 -0500
@@ -1,13 +1,15 @@
 (defpackage :advent/2016/05 #.cl-user::*advent-use*)
 (in-package :advent/2016/05)
 
+(defparameter *fancy* nil)
 (defparameter *spinner* '#1=(#\◴ #\◷ #\◶ #\◵ . #1#))
 
 (defun string->bytes (string)
   (map 'vector #'char-code string))
 
 (defun progress (i)
-  (format t "~C~C  Iteration: ~D" #\Return (pop *spinner*) i)
+  (when *fancy*
+    (format t "~C~C  Iteration: ~D" #\Return (pop *spinner*) i))
   (force-output))
 
 (defun good-hash-p (hash)
@@ -51,9 +53,9 @@
                    (char= (aref part2 pos) #\_)) ; not already seen
           (setf (aref part2 pos) (aref hex 6))
           (when (zerop (decf remaining))
-            (format t " Cracked.~%")
+            (when *fancy* (format t " Cracked.~%"))
             (finish))))
-      (format t " [~A] / [~A]~%" part1 part2)
+      (when *fancy* (format t " [~A] / [~A]~%" part1 part2))
       (progress i))))
 
 
--- a/src/2017/days/day-08.lisp	Sun Dec 08 13:47:53 2019 -0500
+++ b/src/2017/days/day-08.lisp	Sun Dec 08 14:50:54 2019 -0500
@@ -12,7 +12,9 @@
     (macrolet ((r (register) `(gethash ,register registers 0)))
       (iterate
         (for line :in data)
-        (for (reg op delta nil cmp-reg cmp-op cmp-bound) := (read-all-from-string line))
+        (for (reg op delta nil cmp-reg cmp-op cmp-bound)
+             := (let ((*package* (find-package :advent/2017/08)))
+                  (read-all-from-string line)))
         (when (funcall cmp-op (r cmp-reg) cmp-bound)
           (maximizing (incf (r reg) (funcall op delta)) :into highest))
         (finally (return (values (alexandria:extremum (alexandria:hash-table-values registers) #'>) highest)))))))
--- a/src/2018/days/day-03.lisp	Sun Dec 08 13:47:53 2019 -0500
+++ b/src/2018/days/day-03.lisp	Sun Dec 08 14:50:54 2019 -0500
@@ -40,5 +40,5 @@
     (values
       (iterate (for uses :in-array fabric)
                (counting (> uses 1)))
-      (claim-id (first (unique claims :test #'claims-intersect-p))))))
+      (id (first (unique claims :test #'claims-intersect-p))))))