day(12): shift the difference by one
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
327a2d1df4
commit
a41963a338
1 changed files with 4 additions and 4 deletions
|
@ -24,8 +24,8 @@ impl Pattern {
|
|||
.find(|&x| {
|
||||
let d = min(x + 1, self.map[0].len() - x - 1);
|
||||
|
||||
iproduct!(0..self.map.len(), (0..d))
|
||||
.filter(|&(y, dx)| self.map[y][x - dx] != self.map[y][x + dx + 1])
|
||||
iproduct!(0..self.map.len(), (1..=d))
|
||||
.filter(|&(y, dx)| self.map[y][x + 1 - dx] != self.map[y][x + dx])
|
||||
.count()
|
||||
== allowed_error
|
||||
})
|
||||
|
@ -37,8 +37,8 @@ impl Pattern {
|
|||
.find(|&y| {
|
||||
let d = min(y + 1, self.map.len() - y - 1);
|
||||
|
||||
iproduct!(0..self.map[y].len(), (0..d))
|
||||
.filter(|&(x, dy)| self.map[y - dy][x] != self.map[y + dy + 1][x])
|
||||
iproduct!(0..self.map[y].len(), (1..=d))
|
||||
.filter(|&(x, dy)| self.map[y + 1 - dy][x] != self.map[y + dy][x])
|
||||
.count()
|
||||
== allowed_error
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue