Trait zero_sum::Resolution [] [src]

pub trait Resolution {
    fn is_win(&self) -> bool;
    fn is_draw(&self) -> bool;
}

A game's resolution.

This is often an enum that represents each ending a game can have.

Example

For tic-tac-toe, we might have:

enum Mark { X, O }

enum End {
    Win(Mark),
    CatsGame,
}

impl Resolution for End {
    fn is_win(&self) -> bool { if let End::Win(_) = *self { true } else { false } }
    fn is_draw(&self) -> bool { if *self == End::CatsGame { true } else { false } }
}

Required Methods

Implementors