aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/14
diff options
context:
space:
mode:
Diffstat (limited to 'AoC2022/14')
-rw-r--r--AoC2022/14/solver.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/AoC2022/14/solver.el b/AoC2022/14/solver.el
index 749b29b..0ad36fb 100644
--- a/AoC2022/14/solver.el
+++ b/AoC2022/14/solver.el
@@ -128,15 +128,13 @@
(setq x 500 y 0)))))
drops))
-(let* ((instr "498,4 -> 498,6 -> 496,6
-503,4 -> 502,4 -> 502,9 -> 494,9")
- (instr (find-file-noselect "input"))
- (bounds (solver-bounds instr))
- (grid (solver-grid-create bounds))
- )
- (solver-walls instr grid)
- ;; sim
- (solver-simulate grid)
+(defun solver-part1 (instructions)
+ (let* ((bounds (solver-bounds instructions))
+ (grid (solver-grid-create bounds)))
+ (solver-walls instructions grid)
+ (solver-simulate grid)))
- ;; (solver-draw-grid grid)
- )
+(ert-deftest test-part1 ()
+ (should (= 24 (solver-part1 "498,4 -> 498,6 -> 496,6
+503,4 -> 502,4 -> 502,9 -> 494,9")))
+ (should (= 665 (solver-part1 (find-file-noselect "input")))))