pub struct TurnPlan<O, E> { /* private fields */ }Expand description
A computer player that plans its side’s turn on copies of the game: a beam search over its own commands (the module’s docs).
A decision does at most samples × candidates × (1 + width × (depth - 1)) units of work, a unit being one command applied to a copy.
Implementations§
Source§impl<O, E> TurnPlan<O, E>
impl<O, E> TurnPlan<O, E>
Sourcepub fn new(order: O, eval: E, settings: PlanSettings, seed: u64) -> Self
pub fn new(order: O, eval: E, settings: PlanSettings, seed: u64) -> Self
A turn planner whose candidates come from order and whose partial
turns are scored by eval, thinking as settings says. Its choices
follow from seed.
Sourcepub fn settings(&self) -> PlanSettings
pub fn settings(&self) -> PlanSettings
How it thinks.
Sourcepub fn search<R>(&mut self, rules: &R) -> PlanSearch<'_, R, O, E>
pub fn search<R>(&mut self, rules: &R) -> PlanSearch<'_, R, O, E>
Starts a decision in rules, which is not over: its first commands
are listed, its seeds drawn and its copies made.
PlanSearch::advance does the work.
§Panics
If the game lists no legal command, or the order drops them all;
with a message naming determinize when a copy lists other
commands than the real state.
Trait Implementations§
Source§impl<R, O, E> Bot<R> for TurnPlan<O, E>
impl<R, O, E> Bot<R> for TurnPlan<O, E>
Source§fn choose(&mut self, rules: &R) -> R::Command
fn choose(&mut self, rules: &R) -> R::Command
The first command of the best plan (or, at a temperature, one picked by the softmax).
§Panics
As TurnPlan::search and PlanSearch::advance do.