aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2023
diff options
context:
space:
mode:
Diffstat (limited to 'AoC2023')
-rw-r--r--AoC2023/day10/solver.lisp13
1 files changed, 6 insertions, 7 deletions
diff --git a/AoC2023/day10/solver.lisp b/AoC2023/day10/solver.lisp
index 1abe7ef..950752e 100644
--- a/AoC2023/day10/solver.lisp
+++ b/AoC2023/day10/solver.lisp
@@ -113,17 +113,16 @@ LJ.LJ")
insidep)
(correct-start map)
(loop for row across map
- for y from 0 do
- (setf insidep nil)
+ for y from 0
+ for insidep = nil
sum
(loop for col across row
for x from 0
for point = (list y x)
- when (and (gethash point loop-tiles)
- (member col '(#\F #\| #\7)))
- do (setf insidep (not insidep))
- count (and (not (gethash point loop-tiles))
- insidep)))))
+ if (gethash point loop-tiles) do
+ (when (member col '(#\F #\| #\7))
+ (setf insidep (not insidep)))
+ else count insidep))))
(fiveam:test solution
(fiveam:is (= 8 (solver1 (uiop:split-string eg-input :separator '(#\Newline)))))