//! Random play simulation policy //! //! Actions are chosen at random use crate::state::GameState; use crate::tree::node::{Node, RewardVal}; use rand::prelude::IndexedRandom; use std::collections::HashMap; pub fn simulate(node: &Node) -> HashMap { let mut state: S = node.state.clone(); while !state.is_terminal() { let legal_actions = state.get_legal_actions(); let action = legal_actions.choose(&mut rand::rng()).unwrap(); state = state.state_after_action(&action); } state.rewards_for_players() }