diff --git a/src/lib.rs b/src/lib.rs index 13e123f..da7e71a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ use rayon::prelude::*; -use std::ops::{Add, Index, IndexMut, Neg}; +use std::ops::{Add, Index, IndexMut, Sub}; pub enum ReadError { BadSymbol, @@ -49,11 +49,11 @@ impl Add for Pos { } } -impl Neg for Pos { +impl Sub for Pos { type Output = Self; - fn neg(self) -> Self { - Self(-self.0, -self.1) + fn sub(self, other: Self) -> Self { + Self(self.0 - other.0, self.1 - other.1) } } @@ -251,7 +251,7 @@ impl State { for i in dir { match self.lvl[pos + *i] { Cell::Goal(false) | Cell::None => { - let dpos = pos + -*i; + let dpos = pos - *i; match self.lvl[dpos] { Cell::Goal(false) | Cell::None => mbc += 1,