[][src]Struct goban::rules::game::Game

pub struct Game { /* fields omitted */ }

Methods

impl Game
[src]

pub fn goban(&self) -> &Goban
[src]

pub fn prisoners(&self) -> &(u32, u32)
[src]

pub fn turn(&self) -> &bool
[src]

pub fn komi(&self) -> &f32
[src]

pub fn plays(&self) -> &Vec<Goban>
[src]

impl Game
[src]

pub fn set_goban(&mut self, val: Goban) -> &mut Self
[src]

pub fn set_prisoners(&mut self, val: (u32, u32)) -> &mut Self
[src]

pub fn set_turn(&mut self, val: bool) -> &mut Self
[src]

pub fn set_komi(&mut self, val: f32) -> &mut Self
[src]

pub fn set_plays(&mut self, val: Vec<Goban>) -> &mut Self
[src]

impl Game
[src]

pub fn new(size: GobanSizes) -> Game
[src]

impl Game
[src]

pub fn resume(&mut self)
[src]

Resume the game when to players have passed, and want to continue.

pub fn over<T: Rule>(&self) -> bool
[src]

True when the game is over (two passes, or no more legals moves, Resign)

pub fn end_game<T: Rule>(&self) -> Option<EndGame>
[src]

Returns the endgame. None if the game is not finished

pub fn pop(&mut self)
[src]

Removes the last move.

pub fn legals<T: Rule>(
    &self
) -> impl Iterator<Item = Coord> + '_
[src]

Returns a list with legals moves, In the list will appear suicides moves, and ko moves.

pub fn display(&self)
[src]

Prints the goban.

pub fn play(&mut self, play: &Move)
[src]

Method to play on the goban or pass.

pub fn play_with_verifications<R: Rule>(
    &mut self,
    play: &Move
) -> Result<(), PlayError>
[src]

Method to play but it verifies if the play is legal or not.

pub fn calculate_territories(&self) -> (f32, f32)
[src]

Calculates a score for the endgame. It's a naive implementation, it counts only territories with the same color surrounding them.

Returns (black territory, white territory)

pub fn is_suicide(&self, stone: &Stone) -> bool
[src]

Add a stone to the board an then test if the stone or stone group is dead. Returns true if the move is a suicide

pub fn is_ko(&self, stone: &Stone) -> bool
[src]

If the goban is in the configuration of the two plays ago returns true

pub fn super_ko(&self, stone: &Stone) -> bool
[src]

Rule of the super Ko, if any before configuration was already played then the move is illegal

pub fn are_dead(&self, stones: &HashSet<Stone>) -> bool
[src]

Test if a group of stones is dead.

"a group of stones is dead if it doesn't have liberties"

Trait Implementations

impl Clone for Game
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Game

impl Sync for Game

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]