Go v0.4.3 Go.Board View Source

Documentation for Go.Board

Godash port to elixir godash url: https://github.com/duckpunch/godash

Avril 2017, hf

Link to this section Summary

Functions

Add move to a board.

Returns a list of valid adjacent coordinates.

Returns the group for a given coordinate Recursive calculation differs from godash

Returns the validity of a black move

Returns the validity of a move

Returns the validity of a white move

Returns the list of killed stones from a coordinate and color Not in godash

Returns the list of liberties from a coordinate

Returns the numbder of liberties from a coordinate

Returns a list of matching adjacent coordinates It will try to guess the color if not specified

Returns a list of matching adjacent coordinates For a given color

Returns a new Board structure from a map.

Returns the opposite color of a given one.

Pass move. Not in original godash!

Remove the stone at the given location.

Reset. Not in original godash!

Like pass move, but does not change history state. Not in original godash!

Link to this section Types

Specs

color() :: :black | :white | :empty

Specs

coordinate() :: {integer(), integer()}

Specs

list_of_coordinates() :: [coordinate()]

Specs

move() :: {coordinate(), color()}

Specs

t() :: %Go.Board{coordinates: map(), next_turn: color(), size: integer()}

Link to this section Functions

Add move to a board.

Link to this function

adjacent_coordinates(board, coordinate)

View Source

Specs

adjacent_coordinates(t(), coordinate()) :: list_of_coordinates()

Returns a list of valid adjacent coordinates.

Link to this function

group(board, coordinate)

View Source

Specs

group(t(), coordinate()) :: list_of_coordinates()

Returns the group for a given coordinate Recursive calculation differs from godash

Link to this function

killed_stones(board, coordinate, color)

View Source

Specs

killed_stones(t(), coordinate(), color()) :: list_of_coordinates()

Returns the list of killed stones from a coordinate and color Not in godash

Link to this function

liberties(board, coordinate)

View Source

Specs

liberties(t(), coordinate()) :: list_of_coordinates()

Returns the list of liberties from a coordinate

Link to this function

liberty_count(board, coordinate)

View Source

Specs

liberty_count(t(), coordinate()) :: integer()

Returns the numbder of liberties from a coordinate

Link to this function

matching_adjacent_coordinates(board, coordinate)

View Source

Specs

matching_adjacent_coordinates(t(), coordinate()) :: list_of_coordinates()

Returns a list of matching adjacent coordinates It will try to guess the color if not specified

Link to this function

matching_adjacent_coordinates(board, coordinate, color)

View Source

Specs

matching_adjacent_coordinates(t(), coordinate(), color()) ::
  list_of_coordinates()

Returns a list of matching adjacent coordinates For a given color

Link to this function

new(initial_state \\ %{})

View Source

Specs

new(map()) :: t()

Returns a new Board structure from a map.

Specs

opposite_color(color()) :: color()

Returns the opposite color of a given one.

Specs

pass(t(), color()) :: {:ok, t()} | {:error, String.t()}

Pass move. Not in original godash!

Link to this function

place_stone(board, coordinate, color, force \\ false)

View Source

Specs

place_stone(t(), coordinate(), color(), boolean()) ::
  {:ok, t()} | {:error, String.t()}

Place one stone on the board.

Link to this function

place_stones(board, list, color)

View Source

Specs

place_stones(t(), list_of_coordinates(), color()) ::
  {:ok, t()} | {:error, String.t()}
Link to this function

remove_stone(board, coordinate)

View Source

Specs

remove_stone(t(), coordinate()) :: {:ok, t()}

Remove the stone at the given location.

Link to this function

remove_stones(board, list)

View Source

Specs

remove_stones(t(), list_of_coordinates()) :: {:ok, t()}

Specs

reset(t()) :: {:ok, t()}

Reset. Not in original godash!

Specs

toggle_turn(t()) :: {:ok, t()}

Like pass move, but does not change history state. Not in original godash!