Skip to main content

Bot

Trait Bot 

Source
pub trait Bot<R: TurnRules> {
    // Required method
    fn choose(&mut self, rules: &R) -> R::Command;
}
Expand description

A player made of code. play asks it for every command of the sides it plays.

A bot must never learn what the game hides from its players (the luck to come, above all): any randomness of its own comes from a seed it was built with. The same seed and the same states must give the same commands.

Required Methods§

Source

fn choose(&mut self, rules: &R) -> R::Command

The next command in rules, which is not over and has this bot’s side to move. It should be one TurnRules::check accepts; a refused command ends the play with a PlayError.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<R, O, E> Bot<R> for TurnPlan<O, E>
where R: Determinize, R::Command: Clone + PartialEq, O: Order<R>, E: Evaluate<R>,

Source§

impl<R, O, P, E> Bot<R> for Rollout<O, P, E>
where R: Determinize, R::Command: Clone + PartialEq, O: Order<R>, P: Playout<R>, E: Evaluate<R>,

Source§

impl<R: TurnRules, F: FnMut(&R) -> R::Command> Bot<R> for F

A function of the state is a bot (one with no seed, or a seed of its own captured).

Source§

impl<R: TurnRules> Bot<R> for RandomBot