game_solver::player

Trait Player

source
pub trait Player: Sized + Eq {
    // Required methods
    fn count() -> usize;
    fn idx(&self) -> usize;
    fn next(self) -> Self;
    fn previous(self) -> Self;
    fn turn(self) -> Self;
}
Expand description

Represents a player.

Required Methods§

source

fn count() -> usize

The max player count.

source

fn idx(&self) -> usize

The current index of this player starting at 0.

source

fn next(self) -> Self

The next player to play

source

fn previous(self) -> Self

The previous player to play

source

fn turn(self) -> Self

How the player instance ‘changes’ on the next move.

For partizan games, the player doesn’t change: Left stays left; right stays right.

For impartial games, the player does change: Next turns into previous, and previous turns into next

Object Safety§

This trait is not object safe.

Implementors§