check pass for single digit

This commit is contained in:
onyx 2023-12-04 03:13:59 +00:00
parent c9ea61c7f4
commit df7fa4b973

View File

@ -12,16 +12,14 @@ func getGearRatio(row, col int) (int, error) {
continue continue
} }
for _, enginePart := range engineParts[i] { for _, enginePart := range engineParts[i] {
for _, part := range enginePart.digits { for _, digit := range enginePart.digits {
if part.col == col-1 || part.col == col || part.col == col+1 { if digit.pass && digit.col == col-1 || digit.col == col || digit.col == col+1 {
if anyTrue(enginePart.digits) {
partsConsidered = append(partsConsidered, enginePart) partsConsidered = append(partsConsidered, enginePart)
break break
} }
} }
} }
} }
}
if len(partsConsidered) == 2 { if len(partsConsidered) == 2 {
n1, err := partsConsidered[0].realValue() n1, err := partsConsidered[0].realValue()
if err != nil { if err != nil {