PXFEOQ4XPZFDGJN5GEQZDOKK5MTPXJIPWFNGBHOQRKPHHKR5CJMQC
expected_value(game, &|player, infoset| {
let strat = &cfr_trainer.strategy_sum[&(player, infoset.clone())];
let s_sum: f32 = strat.iter().sum();
strat.iter().map(|s| s / s_sum).collect()
})
expected_value(
game,
&|player, infoset| {
let strat = &cfr_trainer.strategy_sum[&(player, infoset.clone())];
let s_sum: f32 = strat.iter().sum();
strat.iter().map(|s| s / s_sum).collect()
},
&mut rng
)
if p == Player::Chance {
let mut ev: ActionVec = game
.players()
.as_ref()
.into_iter()
.filter(|&&p| p != Player::Chance)
.map(|_| 0.0)
.collect();
for i in 0..100 {
let mut game = game.clone();
game.play_chance(rng);
ev.iter_mut()
.zip(expected_value(game, strategy, rng))
.for_each(|(evp, vp)| *evp += (vp - *evp) / (i + 1) as f32);
}
return ev;
}
}
fn play_chance(&mut self, rng: &mut impl Rng) -> f32 {
self.deck.shuffle(rng);
for i in 1..=N {
self.push_history(History(Player::from_usize(i), Action::Deal(self.deck[i])));
self.bets[i - 1] = 1;
}
self.current_bet = 1;
self.current_player = Player::Agent1;
1.0 / (1..=N + 1).product::<usize>() as f32