Skip to main content

Strategy

Trait Strategy 

Source
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§

Source

fn choose_action(&mut self, view: &View<'_>) -> TurnAction

Decides with rolls remaining: hold and reroll, or score now.

Source

fn choose_category(&mut self, view: &View<'_>) -> Category

Decides after the final roll: which category to score.

Provided Methods§

Source

fn name(&self) -> &str

A short display name for logs and arenas.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§