Go v0.1.0 Go.Board

Documentation for Go.Board

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

Avril 2017, hf

Summary

Types

t()

Represents the state for a game of go

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. If You want to clone from an existing structure, transform to a map firstby using

Pass move. Not in original godash!

Remove the stone at the given location

Reset. Not in original godash!

Resign. Not in original godash!

Returns list from board

Generate an ascii board

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

Types

color()
color() :: :black | :white | :empty
coordinate()
coordinate() :: {integer, integer}
list_of_coordinates()
list_of_coordinates() :: [coordinate]
move()
move() :: {coordinate, color}
t()
t() :: %Go.Board{black_captures: integer, consecutive_passes: integer, coordinates: map, history: list, is_over: boolean, komi: float, next_turn: color, placements: list, size: integer, white_captures: integer, winner: color | :none}

Represents the state for a game of go.

Functions

add_move(board, move)
add_move(t, move) :: {:ok, t} | {:error, String.t}

Add move to a board.

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

Returns a list of valid adjacent coordinates.

group(board, coordinate)

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

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

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

liberties(board, coordinate)

Returns the list of liberties from a coordinate

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

Returns the numbder of liberties from a coordinate

matching_adjacent_coordinates(board, coordinate)
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

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

Returns a list of matching adjacent coordinates For a given color

new(initial_state \\ %{})
new(map) :: t

Returns a new Board structure from a map. If You want to clone from an existing structure, transform to a map firstby using :

initial_state |> Map.from_struct |> Go.Board.new

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

Pass move. Not in original godash!

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

Place one stone on the board.

place_stones(board, list, color)
place_stones(t, list_of_coordinates, color) ::
  {:ok, t} |
  {:error, String.t}
remove_stone(board, coordinate)
remove_stone(t, coordinate) :: {:ok, t}

Remove the stone at the given location.

remove_stones(board, list)
remove_stones(t, list_of_coordinates) :: {:ok, t}
reset(board)
reset(t) :: {:ok, t}

Reset. Not in original godash!

resign(board, color)
resign(t, color) :: {:ok, t}

Resign. Not in original godash!

to_array(board)
to_array(t) :: list

Returns list from board.

to_ascii_board(board)
to_ascii_board(t) :: binary

Generate an ascii board.

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

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