pub trait Strategy {
// Required methods
fn choose_action(&mut self, view: &View<'_>) -> TurnAction;
fn choose_category(&mut self, view: &View<'_>) -> Category;
// Provided method
fn name(&self) -> &str { ... }
}Expand description
A decision procedure for playing a turn.
The engine asks choose_action while rolls
remain and choose_category after the third
roll, when only scoring is possible — an illegal reroll is
unrepresentable there. The trait is object-safe, so tables can mix
strategies via &mut dyn Strategy.
Required Methods§
Sourcefn choose_action(&mut self, view: &View<'_>) -> TurnAction
fn choose_action(&mut self, view: &View<'_>) -> TurnAction
Decides with rolls remaining: hold and reroll, or score now.
Sourcefn choose_category(&mut self, view: &View<'_>) -> Category
fn choose_category(&mut self, view: &View<'_>) -> Category
Decides after the final roll: which category to score.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".