From 5c1c3d6c5eec4a18dc7bf7deb566c42ffae61f63 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Sat, 16 Aug 2025 17:25:29 +0200 Subject: [PATCH] fix validations & client_cli --- bot/src/dqn/dqn_common_big.rs | 8 ++++++-- client_cli/src/app.rs | 3 +++ store/src/game.rs | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bot/src/dqn/dqn_common_big.rs b/bot/src/dqn/dqn_common_big.rs index 2da4aa5..ee0dff3 100644 --- a/bot/src/dqn/dqn_common_big.rs +++ b/bot/src/dqn/dqn_common_big.rs @@ -117,10 +117,14 @@ pub fn get_valid_actions(game_state: &crate::GameState) -> Vec { if let Some(color) = player_color { match game_state.turn_stage { - TurnStage::RollDice | TurnStage::RollWaiting => { + TurnStage::RollDice => { valid_actions.push(TrictracAction::Roll); } - TurnStage::MarkPoints | TurnStage::MarkAdvPoints => { + TurnStage::MarkPoints | TurnStage::MarkAdvPoints | TurnStage::RollWaiting => { + panic!( + "get_valid_actions not implemented for turn stage {:?}", + game_state.turn_stage + ); // valid_actions.push(TrictracAction::Mark); } TurnStage::HoldOrGoChoice => { diff --git a/client_cli/src/app.rs b/client_cli/src/app.rs index d400004..50963bf 100644 --- a/client_cli/src/app.rs +++ b/client_cli/src/app.rs @@ -139,6 +139,9 @@ impl App { // &self.game.state.board, // dice, // ); + self.game.handle_event(&GameEvent::Roll { + player_id: self.game.player_id.unwrap(), + }); self.game.handle_event(&GameEvent::RollResult { player_id: self.game.player_id.unwrap(), dice, diff --git a/store/src/game.rs b/store/src/game.rs index a0356a5..9f8926b 100644 --- a/store/src/game.rs +++ b/store/src/game.rs @@ -348,7 +348,7 @@ impl GameState { return false; } // Check the turn stage - if self.turn_stage != TurnStage::RollWaiting { + if self.turn_stage != TurnStage::RollDice { error!("bad stage {:?}", self.turn_stage); return false; } @@ -363,7 +363,7 @@ impl GameState { return false; } // Check the turn stage - if self.turn_stage != TurnStage::RollDice { + if self.turn_stage != TurnStage::RollWaiting { error!("bad stage {:?}", self.turn_stage); return false; }