diff options
| author | Mike White <botahamec@outlook.com> | 2021-08-23 21:22:26 -0400 |
|---|---|---|
| committer | Mike White <botahamec@outlook.com> | 2021-08-23 21:22:26 -0400 |
| commit | ec184715933b200558e8a0fe040f8948661c7eaf (patch) | |
| tree | 57d1e46212a2d5a79ce4634b3bffd4b60d588a54 /model/src | |
| parent | 82c7c7edeb63c9f9082a201822da80e6021b2a11 (diff) | |
Created a basic UI that displays a single position
Diffstat (limited to 'model/src')
| -rw-r--r-- | model/src/lib.rs | 2 | ||||
| -rw-r--r-- | model/src/piece.rs | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/model/src/lib.rs b/model/src/lib.rs index 8c8efb6..1e1b364 100644 --- a/model/src/lib.rs +++ b/model/src/lib.rs @@ -1,9 +1,11 @@ mod board; mod color; mod moves; +mod piece; mod possible_moves; pub use board::CheckersBitBoard; pub use color::PieceColor; pub use moves::Move; +pub use piece::Piece; pub use possible_moves::PossibleMoves; diff --git a/model/src/piece.rs b/model/src/piece.rs new file mode 100644 index 0000000..f36e0a4 --- /dev/null +++ b/model/src/piece.rs @@ -0,0 +1,21 @@ +use crate::PieceColor; + +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub struct Piece { + king: bool, + color: PieceColor, +} + +impl Piece { + pub(crate) const fn new(king: bool, color: PieceColor) -> Self { + Self { king, color } + } + + pub const fn is_king(self) -> bool { + self.king + } + + pub const fn color(self) -> PieceColor { + self.color + } +} |
