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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§