Go v0.4.0 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

Link to this type color() View Source
color() :: :black | :white | :empty
Link to this type coordinate() View Source
coordinate() :: {integer(), integer()}
Link to this type list_of_coordinates() View Source
list_of_coordinates() :: [coordinate()]
Link to this type t() View Source
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
adjacent_coordinates(t(), coordinate()) :: list_of_coordinates()

Returns a list of valid adjacent coordinates.

Link to this function group(board, coordinate) View Source
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
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
liberties(t(), coordinate()) :: list_of_coordinates()

Returns the list of liberties from a coordinate

Link to this function liberty_count(board, coordinate) View Source
liberty_count(t(), coordinate()) :: integer()

Returns the numbder of liberties from a coordinate

Link to this function matching_adjacent_coordinates(board, coordinate) View Source
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
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
new(map()) :: t()

Returns a new Board structure from a map.

Link to this function opposite_color(color) View Source
opposite_color(color()) :: color()

Returns the opposite color of a given one.

Link to this function pass(board, color) View Source
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
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
place_stones(t(), list_of_coordinates(), color()) ::
  {:ok, t()} | {:error, String.t()}
Link to this function remove_stone(board, coordinate) View Source
remove_stone(t(), coordinate()) :: {:ok, t()}

Remove the stone at the given location.

Link to this function remove_stones(board, list) View Source
remove_stones(t(), list_of_coordinates()) :: {:ok, t()}
Link to this function reset(board) View Source
reset(t()) :: {:ok, t()}

Reset. Not in original godash!

Link to this function toggle_turn(board) View Source
toggle_turn(t()) :: {:ok, t()}

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