Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/engine-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ fn to_js<T: Serialize + ?Sized>(value: &T) -> JsValue {

use phase_ai::config::{create_config_for_players, AiDifficulty, Platform};
use phase_ai::{
choose_action_with_session, score_candidates_with_session, softmax_select_pairs, AiSession,
SessionCache,
choose_action_with_session, score_candidates_for_parallel_worker,
select_safe_action_from_scores, AiSession, SessionCache,
};
thread_local! {
/// Game state uses Cell<Option<T>> with take/set to avoid RefCell borrow poisoning.
Expand Down Expand Up @@ -2011,11 +2011,11 @@ pub fn get_ai_scored_candidates(
let config =
create_config_for_players(difficulty, Platform::Wasm, state.players.len() as u8);
let session = ai_session_for(state);
Ok(to_js(&score_candidates_with_session(
Ok(to_js(&score_candidates_for_parallel_worker(
state,
PlayerId(player_id),
&config,
&session,
Some(&session),
)))
})?
}
Expand Down Expand Up @@ -2058,7 +2058,8 @@ pub fn get_ai_action_proposal_from_scores(
let config =
create_config_for_players(difficulty, Platform::Wasm, state.players.len() as u8);
let mut rng = ChaCha20Rng::seed_from_u64(rng_seed);
let Some(action) = softmax_select_pairs(&admissible_scores, config.temperature, &mut rng)
let Some(action) =
select_safe_action_from_scores(state, &admissible_scores, config.temperature, &mut rng)
else {
return Ok(JsValue::NULL);
};
Expand Down
Loading
Loading