Trait ggp_rs::Player [−] [src]

pub trait Player: Send {
    fn name(&self) -> String;
    fn select_move(&mut self, game: &Game) -> Move;

    fn meta_game(&mut self, _: &Game) { ... }
    fn cutoff(&self) -> u32 { ... }
    fn out_of_time(&mut self, _: &Game) -> Move { ... }
    fn stop(&mut self, _: &Game) { ... }
}

A GGP player

Required Methods

fn name(&self) -> String

Returns the name of this player

fn select_move(&mut self, game: &Game) -> Move

Called after receiving a play message. Returns a Move for this turn.

Provided Methods

fn meta_game(&mut self, _: &Game)

Called after receiving a start message. Used to perform any computation before the start of the game.

fn cutoff(&self) -> u32

The cutoff for the remaining time for the start or play clock in milliseconds, after which out_of_time should be called. Note that this function does not call out_of_time, but is simply used by other functions when deciding whether to call it. Defaults to 500 milliseconds.

fn out_of_time(&mut self, _: &Game) -> Move

Gets a move to play when there is no more time left for computation. While it is not required that clients implement this function to use the Player trait, the default implementation will panic. This is so players that do not want to use this feature can ignore it. Instead of calling this function directly, you can use the check_time! and check_time_result! macros.

fn stop(&mut self, _: &Game)

Called when a game is finished or aborted

Implementors