|
|
@ -10,14 +10,14 @@ impl Behaviour { |
|
|
|
|
|
|
|
pub fn validate_dest(&self, origin: (u8, u8), destination: (u8, u8)) -> bool { |
|
|
|
// original plan was to use match but i felt for loops would work better since we dont yet know the extent of moves vector
|
|
|
|
// println!("origin: ({}, {}), destination: ({}, {})", origin.0, origin.1, destination.0, destination.1);
|
|
|
|
// println!("origin: ({}, {}), destination: ({}, {})",origin.0, origin.1, destination.0, destination.1);
|
|
|
|
for moveset in self.moves.iter() { |
|
|
|
for dir in self.dirs.iter() { |
|
|
|
// mind blanking need to add something to confirm which direction we are iterating through
|
|
|
|
// println!("Permissible: ({}, {})", (origin.0 as i8) + dir.0 * moveset.0,(origin.1 as i8) - dir.1 * moveset.1);
|
|
|
|
// println!("Permissible: ({}, {})",(origin.0 as i8) + dir.0 * moveset.0,(origin.1 as i8) - dir.1 * moveset.1);
|
|
|
|
if ( |
|
|
|
((origin.0 as i8) + dir.0 * moveset.0) as u8, |
|
|
|
((origin.1 as i8) - dir.1 * moveset.1) as u8, |
|
|
|
((origin.0 as i8) + moveset.0 * dir.0) as u8, |
|
|
|
((origin.1 as i8) - moveset.1 * dir.1) as u8, |
|
|
|
) == destination |
|
|
|
{ |
|
|
|
return true; |
|
|
|