aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/14
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2022-12-16 17:09:05 +0100
committerOscar Najera <hi@oscarnajera.com>2022-12-16 17:09:05 +0100
commit303cdd468606b50cfa2bef5a9b196fd04ea58187 (patch)
treef370bde7a5879a5548107bedb09eed6d17675f6f /AoC2022/14
parent135ce20d06bdee95299fa4ad1c100da4ddd2a4e4 (diff)
downloadscratch-303cdd468606b50cfa2bef5a9b196fd04ea58187.tar.gz
scratch-303cdd468606b50cfa2bef5a9b196fd04ea58187.tar.bz2
scratch-303cdd468606b50cfa2bef5a9b196fd04ea58187.zip
test
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")))))