wip
This commit is contained in:
parent
223777346a
commit
6414565c0e
1 changed files with 7 additions and 7 deletions
|
|
@ -89,15 +89,15 @@ impl TricTrac {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_action(&mut self, action_idx: usize) -> PyResult<()> {
|
fn apply_action(&mut self, action_idx: usize) -> PyResult<()> {
|
||||||
if let Some(event) =
|
if let Some(event) = TrictracAction::from_action_index(action_idx).and_then(|a| {
|
||||||
TrictracAction::from_action_index(action_idx).and_then(|a| a.to_event(&self.game_state))
|
let game_state = if self.game_state.active_player_id == 2 {
|
||||||
{
|
&self.game_state.mirror()
|
||||||
println!("apply action on {:?} ", event);
|
|
||||||
let event = if self.game_state.active_player_id == 2 {
|
|
||||||
event.get_mirror(true)
|
|
||||||
} else {
|
} 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);
|
println!("validating event {:?} on state {}", event, self.game_state);
|
||||||
if self.game_state.validate(&event) {
|
if self.game_state.validate(&event) {
|
||||||
println!("valid event");
|
println!("valid event");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue