From ce0ccaaafac86acef493c58bd1828bfef2c0bb12 Mon Sep 17 00:00:00 2001 From: Gabriel Bizdoc Date: Thu, 4 Dec 2025 09:11:40 +0200 Subject: [PATCH] day 4 cleanup --- year25/day4.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/year25/day4.go b/year25/day4.go index ba39269..8d84909 100644 --- a/year25/day4.go +++ b/year25/day4.go @@ -11,6 +11,7 @@ const Day4PaperRoll = '@' func Day4Part1(r io.Reader, l Logger) (any, error) { // 4 rolls in 8 adjacent positions + const maxAdjacentRolls = 4 var accessibleRolls int g, err := geometry.ReaderToByteGrid(r) @@ -30,7 +31,7 @@ func Day4Part1(r io.Reader, l Logger) (any, error) { } } - if count <= 4 { + if count <= maxAdjacentRolls { accessibleRolls += 1 } } @@ -40,6 +41,7 @@ func Day4Part1(r io.Reader, l Logger) (any, error) { func Day4Part2(r io.Reader, l Logger) (any, error) { // 4 rolls in 8 adjacent positions + const maxAdjacentRolls = 4 var totalRemovedRolls int g, err := geometry.ReaderToByteGrid(r) @@ -61,7 +63,7 @@ func Day4Part2(r io.Reader, l Logger) (any, error) { } } - if count <= 4 { + if count <= maxAdjacentRolls { removedRolls += 1 g.Set(c, '.') // remove grid }