This commit is contained in:
Daniel Lovbrotte Olsen 2024-02-11 02:31:38 +01:00
parent 5a954d1c9a
commit 583e941b6c
1 changed files with 5 additions and 3 deletions

View File

@ -26,7 +26,7 @@ pub struct GameState {
rng: Box<dyn RngCore + Send>,
}
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
pub struct PlayerName(String);
impl From<String> for PlayerName {
@ -351,6 +351,7 @@ impl GameState {
let to_line = usize::min(amount, remaining_capacity);
let to_floor = amount - to_line;
pattern_line.color = Some(c);
pattern_line.number += to_line;
self.players.get_mut(&self.current_player).unwrap()
.floor
@ -370,10 +371,12 @@ impl GameState {
.player_names
.iter()
.cycle()
.skip_while(|&a| a != &self.current_player)
.skip_while(|a| **a != self.current_player)
.skip(1)
.next()
.unwrap()
.to_owned();
Ok(())
}
@ -842,7 +845,6 @@ pub struct GameMove {
}
#[derive(Serialize, Deserialize, Clone, Copy)]
#[serde(untagged)]
enum Policy {
/// Anything weird will return an error
#[serde(rename = "strict")]