move all doors to the ends of corridors

This commit is contained in:
Llywelwyn 2023-10-02 07:39:45 +01:00
parent 7a27321bec
commit 190543a361
2 changed files with 69 additions and 21 deletions

View file

@ -85,6 +85,15 @@ impl Direction {
Direction::West => Point::new(-1, 0),
}
}
pub fn opposite_dir(&self) -> Direction {
match self {
Direction::NoDir => unreachable!("Direction::NoDir has no opposite."),
Direction::North => Direction::South,
Direction::East => Direction::West,
Direction::South => Direction::North,
Direction::West => Direction::East,
}
}
}
pub struct DirectionIterator {