wip (tests fails)
This commit is contained in:
parent
56d155b911
commit
c1e99a5f35
|
|
@ -187,10 +187,6 @@ impl Environment for TrictracEnvironment {
|
|||
|
||||
// Faire jouer l'adversaire (stratégie simple)
|
||||
if has_played {
|
||||
print!(
|
||||
"?({},{:?}) ",
|
||||
self.game.active_player_id, self.game.turn_stage
|
||||
);
|
||||
if self.goodmoves_count > 10 {
|
||||
println!("{:?}", self.game.history);
|
||||
panic!("end debug");
|
||||
|
|
@ -222,7 +218,6 @@ impl Environment for TrictracEnvironment {
|
|||
// Mettre à jour l'état
|
||||
self.current_state = TrictracState::from_game_state(&self.game);
|
||||
self.episode_reward += reward;
|
||||
|
||||
if self.visualized && terminated {
|
||||
println!(
|
||||
"Episode terminé. Récompense totale: {:.2}, Étapes: {}",
|
||||
|
|
@ -373,6 +368,7 @@ impl TrictracEnvironment {
|
|||
|
||||
/// Fait jouer l'adversaire avec une stratégie simple
|
||||
fn play_opponent_if_needed(&mut self) -> f32 {
|
||||
print!("z?");
|
||||
let mut reward = 0.0;
|
||||
|
||||
// Si c'est le tour de l'adversaire, jouer automatiquement
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ Player :: holes :: points
|
|||
seed: Some(1327),
|
||||
bot: Some("dummy".into()),
|
||||
});
|
||||
println!("avant : {}", app.display());
|
||||
app.input("roll");
|
||||
app.input("1 3");
|
||||
app.input("1 4");
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ impl GameRunner {
|
|||
} else {
|
||||
debug!("{}", self.state);
|
||||
error!("event not valid : {event:?}");
|
||||
panic!("crash and burn");
|
||||
panic!("crash and burn {} \nevt not valid {event:?}", self.state);
|
||||
&GameEvent::PlayError
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ impl GameState {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
Roll { player_id } | RollResult { player_id, dice: _ } => {
|
||||
Roll { player_id } => {
|
||||
// Check player exists
|
||||
if !self.players.contains_key(player_id) {
|
||||
return false;
|
||||
|
|
@ -347,6 +347,26 @@ impl GameState {
|
|||
if self.active_player_id != *player_id {
|
||||
return false;
|
||||
}
|
||||
// Check the turn stage
|
||||
if self.turn_stage != TurnStage::RollWaiting {
|
||||
error!("bad stage {:?}", self.turn_stage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
RollResult { player_id, dice: _ } => {
|
||||
// Check player exists
|
||||
if !self.players.contains_key(player_id) {
|
||||
return false;
|
||||
}
|
||||
// Check player is currently the one making their move
|
||||
if self.active_player_id != *player_id {
|
||||
return false;
|
||||
}
|
||||
// Check the turn stage
|
||||
if self.turn_stage != TurnStage::RollDice {
|
||||
error!("bad stage {:?}", self.turn_stage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Mark {
|
||||
player_id,
|
||||
|
|
|
|||
Loading…
Reference in a new issue