1
0
Fork 0

day(13): take the factor out of helper function

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-12-13 21:39:29 +01:00
parent a41963a338
commit b3e7037f33
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -42,14 +42,14 @@ impl Pattern {
.count()
== allowed_error
})
.map(|y| 100 * (y + 1) as i32)
.map(|y| (y + 1) as i32)
}
fn score(&self, allowed_error: usize) -> i32 {
if let Some(s) = self.check_vertically(allowed_error) {
s
} else if let Some(s) = self.check_horizontally(allowed_error) {
s
100 * s
} else {
unreachable!()
}