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| {
|
.find(|&x| {
|
||||||
let d = min(x + 1, self.map[0].len() - x - 1);
|
let d = min(x + 1, self.map[0].len() - x - 1);
|
||||||
|
|
||||||
iproduct!(0..self.map.len(), (0..d))
|
iproduct!(0..self.map.len(), (1..=d))
|
||||||
.filter(|&(y, dx)| self.map[y][x - dx] != self.map[y][x + dx + 1])
|
.filter(|&(y, dx)| self.map[y][x + 1 - dx] != self.map[y][x + dx])
|
||||||
.count()
|
.count()
|
||||||
== allowed_error
|
== allowed_error
|
||||||
})
|
})
|
||||||
|
@ -37,8 +37,8 @@ impl Pattern {
|
||||||
.find(|&y| {
|
.find(|&y| {
|
||||||
let d = min(y + 1, self.map.len() - y - 1);
|
let d = min(y + 1, self.map.len() - y - 1);
|
||||||
|
|
||||||
iproduct!(0..self.map[y].len(), (0..d))
|
iproduct!(0..self.map[y].len(), (1..=d))
|
||||||
.filter(|&(x, dy)| self.map[y - dy][x] != self.map[y + dy + 1][x])
|
.filter(|&(x, dy)| self.map[y + 1 - dy][x] != self.map[y + dy][x])
|
||||||
.count()
|
.count()
|
||||||
== allowed_error
|
== allowed_error
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue