wip mirror
This commit is contained in:
parent
f1461985ac
commit
f9f4405943
3 changed files with 61 additions and 18 deletions
|
|
@ -34,9 +34,9 @@ impl Default for Bot {
|
|||
fn default() -> Self {
|
||||
let strategy = DefaultStrategy::default();
|
||||
Self {
|
||||
player_id: 2,
|
||||
player_id: 1,
|
||||
strategy: Box::new(strategy),
|
||||
// color: Color::Black,
|
||||
color: Color::White,
|
||||
// schools_enabled: false,
|
||||
}
|
||||
}
|
||||
|
|
@ -64,26 +64,17 @@ impl Bot {
|
|||
|
||||
pub fn handle_event(&mut self, event: &GameEvent) -> Option<GameEvent> {
|
||||
let game = self.strategy.get_mut_game();
|
||||
let mirror_event = if let GameEvent::Move {
|
||||
player_id,
|
||||
moves: (move1, move2),
|
||||
} = event
|
||||
{
|
||||
&GameEvent::Move {
|
||||
player_id: *player_id,
|
||||
moves: (move1.mirror(), move2.mirror()),
|
||||
}
|
||||
let internal_event = if self.color == Color::Black {
|
||||
&event.get_mirror()
|
||||
} else {
|
||||
event
|
||||
};
|
||||
game.consume(if self.color == Color::White {
|
||||
event
|
||||
} else {
|
||||
mirror_event
|
||||
});
|
||||
|
||||
game.consume(internal_event);
|
||||
if game.stage == Stage::Ended {
|
||||
return None;
|
||||
}
|
||||
// TODO mirror
|
||||
if game.active_player_id == self.player_id {
|
||||
return match game.turn_stage {
|
||||
TurnStage::MarkAdvPoints => Some(GameEvent::Mark {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ impl Default for DefaultStrategy {
|
|||
let game = GameState::default();
|
||||
Self {
|
||||
game,
|
||||
player_id: 2,
|
||||
color: Color::Black,
|
||||
player_id: 1,
|
||||
color: Color::White,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue