From 4e98678ccdff498400380fd5dd2d7e8b73097d11 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 17 Jul 2022 23:06:43 +0200 Subject: [PATCH] Add 'board::Direction' enum --- src/board/directions.rs | 22 ++++++++++++++++++++++ src/board/mod.rs | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 src/board/directions.rs diff --git a/src/board/directions.rs b/src/board/directions.rs new file mode 100644 index 0000000..7e10ab3 --- /dev/null +++ b/src/board/directions.rs @@ -0,0 +1,22 @@ +/// A direction on the board. Either along the rook, bishop, or knight directions +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum Direction { + North, + West, + South, + East, + + NorthWest, + SouthWest, + SouthEast, + NorthEast, + + NorthNorthWest, + NorthWestWest, + SouthWestWest, + SouthSouthWest, + SouthSouthEast, + SouthEastEast, + NorthEastEast, + NorthNorthEast, +} diff --git a/src/board/mod.rs b/src/board/mod.rs index 7923cab..bc9d1d9 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -1,6 +1,9 @@ pub mod bitboard; pub use bitboard::*; +pub mod directions; +pub use directions::*; + pub mod file; pub use file::*;