This commit is contained in:
Henri Bourcereau 2024-01-09 20:50:52 +01:00
parent 23ab966602
commit 14ae91eae7
2 changed files with 22 additions and 11 deletions

View file

@ -9,7 +9,9 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fmt;
/// The different states a game can be in. (not to be confused with the entire "GameState")
type TGPN = [u8];
/// The different stages a game can be in. (not to be confused with the entire "GameState")
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Stage {
PreGame,
@ -17,7 +19,7 @@ pub enum Stage {
Ended,
}
/// The different states a game turn can be in.
/// The different stages a game turn can be in.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TurnStage {
RollDice,
@ -72,6 +74,11 @@ impl GameState {
GameState::default()
}
/// Format to TGPN notation (Tables games position notation)
fn toTGPN(&self, f: &mut fmt::Formatter) -> TGPN {
b"ll"
}
pub fn who_plays(&self) -> Option<&Player> {
self.players.get(&self.active_player_id)
}