mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-28 11:10:44 +01:00
chore: add moving the pawn
This commit is contained in:
@@ -5,10 +5,26 @@ use uuid::Uuid;
|
||||
pub struct Player {
|
||||
pub name: String,
|
||||
pub id: Uuid,
|
||||
/// Row where players pawns turn into dames
|
||||
pub end_row: usize,
|
||||
}
|
||||
|
||||
impl Player {
|
||||
pub fn new(name: String) -> Self {
|
||||
Player {
|
||||
name,
|
||||
id: Uuid::new_v4(),
|
||||
end_row: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Player {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "(name: {}, id, {})", self.name, self.id)
|
||||
write!(
|
||||
f,
|
||||
"(name: {}, id: {}, end_row: {})",
|
||||
self.name, self.id, self.end_row
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user