use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum NeighborDirection {
Right,
Left,
Up,
Down,
}
impl NeighborDirection {
pub fn opposite(self) -> Self {
match self {
Self::Right => Self::Left,
Self::Left => Self::Right,
Self::Up => Self::Down,
Self::Down => Self::Up,
}
}
pub fn delta(self) -> (i32, i32) {
match self {
Self::Right => (1, 0),
Self::Left => (-1, 0),
Self::Up => (0, -1),
Self::Down => (0, 1),
}
}
}
#[derive(Debug)]
pub struct NodeNeighbor {
pub direction: NeighborDirection,
pub index: usize,
pub distance: f32,
pub score: f32,
}