This commit is contained in:
Henri Bourcereau 2026-02-22 10:57:14 +01:00
parent 223777346a
commit 6414565c0e

View file

@ -89,15 +89,15 @@ impl TricTrac {
}
fn apply_action(&mut self, action_idx: usize) -> PyResult<()> {
if let Some(event) =
TrictracAction::from_action_index(action_idx).and_then(|a| a.to_event(&self.game_state))
{
println!("apply action on {:?} ", event);
let event = if self.game_state.active_player_id == 2 {
event.get_mirror(true)
if let Some(event) = TrictracAction::from_action_index(action_idx).and_then(|a| {
let game_state = if self.game_state.active_player_id == 2 {
&self.game_state.mirror()
} else {
event
&self.game_state
};
println!("action {}, game_state {}", a, game_state);
a.to_event(game_state)
}) {
println!("validating event {:?} on state {}", event, self.game_state);
if self.game_state.validate(&event) {
println!("valid event");