refactoring (probably needed for previous days too, oops)

This commit is contained in:
2021-12-21 23:46:46 +01:00
parent 089f2c8800
commit aa77b51cd0
3 changed files with 26 additions and 13 deletions

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)))