Struct goban::pieces::goban::Goban[][src]

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

Represents a Goban. the stones are stored in ROW MAJOR (row, column)

Implementations

Creates a Goban

Arguments
  • (height, width) a tuple with the height and the width of the desired goban.

Creates a Goban from an array of stones.

Returns the underlying goban in a vector with a RowMajor Policy, calculated on the fly.

Like vec but in a matrix shape.

Get number of stones on the goban. (number of black stones, number of white stones)

Put a stones in the goban. default (line, column) the (0,0) point is in the top left.

Panics

if the point is out of bounds

Helper function to put a stone.

Put many stones.

Get the chain from their id

Get all the neighbors to the coordinate including empty intersections.

Get all the stones that are neighbor to the coord except empty intersections.

Get all the neighbors indexes to the point. Only return point with a color.

Get all the chains adjacent to the point. The result iterator can contains duplicates.

Function for getting the stone in the goban.

Get all the stones except “Empty stones”

Get stones by their color.

Get points by their color.

Returns the “empty” stones connected to the stone

Returns true if the stone has liberties.

Get a string for printing the goban in normal shape (0,0) left bottom

Remove a string from the game, it add liberties to all adjacent chains that aren’t the same color.

Get the chain of stones connected to a stone. with a Breadth First Search, works for Empty stones too.

Ex: Passing a stone ‘a’ it will return and HashSet [a,b,t,z] with the string where the stone is. It will return the stone alone if it’s lonely

Pass a iterator of stones [x,a] and It will compute the string of each stone stones. Use a breadth first search to deduce the groups of connected stones. Get stones connected. [[x,y,z],[a,e,r]] example of return.

Get two iterators of empty stones.

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)

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

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Converts the given value to a String. 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.