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

pub struct Goban { /* fields omitted */ }

Represents a Goban. With an array with the stones encoded in u8. and the size.

Methods

impl Goban[src]

pub fn tab(&self) -> &Vec<u8>[src]

The values are stored in a one dimension vector. Using the RowMajor Policy.

pub fn b_stones(&self) -> &Vec<bool>[src]

For future repr

pub fn w_stones(&self) -> &Vec<bool>[src]

pub fn size(&self) -> &usize[src]

impl Goban[src]

pub fn new(size: usize) -> Self[src]

pub fn new_with_order(size: usize, order: Order) -> Self[src]

pub fn from_array(stones: &[u8], order: Order) -> Self[src]

Creates a goban from an array of stones.

pub fn clear(&mut self)[src]

Removes all the stones from the goban.

pub fn push(
    &mut self,
    coord: &Coord,
    color: Color
) -> Result<&mut Goban, String>
[src]

Put a stones in the goban. The coord depends on the order choose. default (line, colomn) the (0,0) coord is in the top left.

pub fn push_many<'a>(
    &'a mut self,
    coords: impl Iterator<Item = &'a Coord>,
    value: Color
)
[src]

Put many stones.

pub fn push_stone(&mut self, stone: &Stone) -> Result<&mut Goban, String>[src]

pub fn get(&self, coord: &Coord) -> Color[src]

pub fn get_neighbors(&self, coord: &Coord) -> impl Iterator<Item = Stone> + '_[src]

Get all the neighbors to the coordinate

pub fn get_neighbors_stones(
    &self,
    coord: &Coord
) -> impl Iterator<Item = Stone> + '_
[src]

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

pub fn get_stones(&self) -> impl Iterator<Item = Stone> + '_[src]

Get all the stones except "Empty stones"

pub fn get_stones_by_color(
    &self,
    color: Color
) -> impl Iterator<Item = Stone> + '_
[src]

Get stones by their color.

pub fn get_liberties(&self, point: &Stone) -> impl Iterator<Item = Stone> + '_[src]

Returns the empty stones connected to the point

pub fn get_nb_liberties(&self, point: &Stone) -> u8[src]

Returns the number of liberties. of the stone

pub fn has_liberties(&self, point: &Stone) -> bool[src]

Returns true if the stone has liberties.

pub fn raw_string(&self) -> String[src]

Get a string for printing the goban in the memory shape (0,0) right top

pub fn pretty_string(&self) -> String[src]

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

impl Goban[src]

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"

pub fn get_connected_stones(&self) -> Vec<HashSet<Stone>>[src]

Get all the groups of connected stones, who has at least one stones without liberties.

pub fn get_connected_stones_color(&self, color: Color) -> Vec<HashSet<Stone>>[src]

Get all the groups of connected stones of a color, who has at leart one stone without liberties.

if the color is empty it's an undefined behaviour

pub fn bfs(&self, point: &Stone) -> HashSet<Stone>[src]

Can get a group of stones and his neighbors with a Breadth First Search, works for Empty stones too.

pub fn get_strongly_connected_stones(
    &self,
    stones: impl Iterator<Item = Stone>
) -> Vec<HashSet<Stone>>
[src]

Use a breadth first search to deduce the groups of connected stones. Get stones connected. [[x,y,z],[a,e,r]] example of return.

Trait Implementations

impl PartialEq<Goban> for Goban[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Clone for Goban[src]

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

Performs copy-assignment from source. Read more

impl Eq for Goban[src]

impl Display for Goban[src]

impl Debug for Goban[src]

Auto Trait Implementations

impl Send for Goban

impl Sync for Goban

Blanket Implementations

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> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

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

type Error = Infallible

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

The type returned in the event of a conversion error.

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