refactoring (probably needed for previous days too, oops)

This commit is contained in:
daniel committed 2021-12-21 23:46:46 +01:00
1 parent 089f2c8800
commit aa77b51cd0
3 files changed
+26 -13

No files matched your search

+2 -2
View File
@@ -22,7 +22,7 @@
(define (step! matrix)
(let [(flashes '())]
; increase energy of all octopuses
(visit-matrix!
(update-matrix!
matrix
(lambda (x y energy)
(when (= energy 9)
@@ -35,7 +35,7 @@
(flash! matrix (vec2i-x (car flash))
(vec2i-y (car flash)))))))
; drain all octopuses that flashed
(visit-matrix!
(update-matrix!
matrix
(lambda (x y energy)
(if (< energy 10) energy 0)))