improve player management

This commit is contained in:
2025-01-28 14:16:16 -05:00
parent 17e774ae57
commit 565f638b1b
5 changed files with 42 additions and 43 deletions

29
src/piece.rs Normal file
View File

@@ -0,0 +1,29 @@
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Piece {
Black,
White,
}
impl Piece {
pub const fn flip(&self) -> Self {
match self {
Piece::Black => Piece::White,
Piece::White => Piece::Black,
}
}
pub const fn text(&self) -> &'static str {
match self {
Piece::White => "",
Piece::Black => "",
}
}
}
impl std::ops::Not for Piece {
type Output = Piece;
fn not(self) -> Self::Output {
self.flip()
}
}