wip debug default bot mirror
This commit is contained in:
parent
3dce910bea
commit
be027c8ec4
|
|
@ -71,6 +71,8 @@ impl Bot {
|
|||
event
|
||||
};
|
||||
|
||||
let init_player_points = game.who_plays().map(|p| p.points);
|
||||
let turn_stage = game.turn_stage;
|
||||
game.consume(internal_event);
|
||||
if game.stage == Stage::Ended {
|
||||
return None;
|
||||
|
|
@ -85,6 +87,13 @@ impl Bot {
|
|||
game.active_player_id
|
||||
};
|
||||
if active_player_id == self.player_id {
|
||||
let player_points = game.who_plays().map(|p| p.points);
|
||||
if self.color == Color::Black {
|
||||
println!(
|
||||
" input evt : {:?}, {:?}, {:?}",
|
||||
internal_event, init_player_points, turn_stage
|
||||
);
|
||||
}
|
||||
let internal_event = match game.turn_stage {
|
||||
TurnStage::MarkAdvPoints => Some(GameEvent::Mark {
|
||||
player_id: 1,
|
||||
|
|
@ -112,7 +121,10 @@ impl Bot {
|
|||
_ => None,
|
||||
};
|
||||
return if self.color == Color::Black {
|
||||
println!(" evt : {:?}", internal_event);
|
||||
println!(
|
||||
" bot evt : {:?} - {:?}",
|
||||
internal_event, player_points
|
||||
);
|
||||
internal_event.map(|evt| evt.get_mirror())
|
||||
} else {
|
||||
internal_event
|
||||
|
|
|
|||
|
|
@ -377,10 +377,12 @@ impl GameState {
|
|||
}
|
||||
// Check player is currently the one making their move
|
||||
if self.active_player_id != *player_id {
|
||||
error!("Player not active : {}", self.active_player_id);
|
||||
return false;
|
||||
}
|
||||
// Check the player can leave (ie the game is in the KeepOrLeaveChoice stage)
|
||||
if self.turn_stage != TurnStage::HoldOrGoChoice {
|
||||
error!("bad stage {:?}", self.turn_stage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -517,7 +519,9 @@ impl GameState {
|
|||
// the points earned by the opponent will be marked on its turn
|
||||
let new_hole = self.mark_points(self.active_player_id, self.dice_points.0);
|
||||
if new_hole {
|
||||
if self.get_active_player().unwrap().holes > 12 {
|
||||
let holes_count = self.get_active_player().unwrap().holes;
|
||||
println!("new hole -> {:?}", holes_count);
|
||||
if holes_count > 12 {
|
||||
self.stage = Stage::Ended;
|
||||
} else {
|
||||
self.turn_stage = TurnStage::HoldOrGoChoice;
|
||||
|
|
|
|||
Loading…
Reference in a new issue