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

Performs the conversion.

Performs the conversion.

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)

recently added

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

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