From df7fa4b973b64c39e39f7ebdeac0b482d4e2d728 Mon Sep 17 00:00:00 2001 From: onyx Date: Mon, 4 Dec 2023 03:13:59 +0000 Subject: [PATCH] check pass for single digit --- day-3/two.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/day-3/two.go b/day-3/two.go index c4b0723..dce3ab6 100644 --- a/day-3/two.go +++ b/day-3/two.go @@ -12,12 +12,10 @@ func getGearRatio(row, col int) (int, error) { continue } for _, enginePart := range engineParts[i] { - for _, part := range enginePart.digits { - if part.col == col-1 || part.col == col || part.col == col+1 { - if anyTrue(enginePart.digits) { - partsConsidered = append(partsConsidered, enginePart) - break - } + for _, digit := range enginePart.digits { + if digit.pass && digit.col == col-1 || digit.col == col || digit.col == col+1 { + partsConsidered = append(partsConsidered, enginePart) + break } } }