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

pub struct Game { /* fields omitted */ }
Expand description

Most important struct of the library, it’s the entry point. It represents a Game of Go.

Implementations

Crates a new game for playing Go

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

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

Returns the endgame. None if the game is not finished

Generate all moves on all empty intersections. Lazy.

Get all moves on all empty intersections.

Returns a list with legals moves. from the rule specified in at the creation.

Return a list with the legals moves. doesn’t take the rule specified in the game but take the one passed on parameter.

Method to play on the goban or pass. (0,0) is in the top left corner of the goban.

Panics

If the coordinates of the move are outside the board.

This methods plays a move then return the hash of the goban simulated, used in legals for fast move simulation in Super Ko situations.

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

Errors

If the move is a suicide Move return SuicideMove If the move is a Ko Move returns Ko if point is already filled then return PointNotEmpty If the game is paused then return GamePaused

Put the handicap stones on the goban. This put the turn for white but doesn’t update the komi.

Calculates score. with prisoners and komi. Dependant of the rule in the game.

Calculates the score by the rule passed in parameter.

Returns true if the stone played in that point will capture another string.

Test if a point is legal or not for the current player,

Test if a point is legal or not by the rule passed in parameter.

Detects true eyes. return true is the stone is an eye. Except for this form :

 ++
 + ++
 ++ +
   ++

This function is only used for performance checking in the rules, and not for checking is a point is really an eye !

Test if a play is ko. If the goban is in the configuration of two plays ago returns true

Rule of the super Ko, if any before configuration was already played then return true.

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

Displays the internal board.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Causes self to use its Binary implementation when Debug-formatted. Read more

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted. Read more

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Formats each item in a sequence. Read more

Performs the conversion.

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

Uses borrowed data to replace owned data, usually by cloning. Read more

Attempts to convert self into T using TryInto<T>. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.