Go v0.2.0 Go.Game
Documentation for Go.Game
This is the main entity since version 0.2.0
It manages the count (komi, captures) and history of turns. It manages superko rule
It delegates rest of play to a current_board
June 2017, hf
Examples
iex> alias Go.{Game, Board}
iex> game = Game.new
iex> {:ok, game} = game |> Game.add_move({{3, 3}, :black})
iex> {:ok, game} = game |> Game.add_move({{16, 3}, :white})
iex> {:ok, game} = game |> Game.add_move({{3, 16}, :black})
iex> {:ok, game} = game |> Game.add_move({{16, 16}, :white})
iex> current_board = game.current_board
iex> current_board.coordinates[{3, 3}]
:black
iex> current_board.coordinates[{16, 16}]
:white
Summary
Functions
Add move to a game
Returns a new Game structure from an optional map or struct
Pass move
Place one stone on the game
Remove the stone at the given location
Reset the game, but keep size and komi
Resign the game, status will change to is_over
Like pass move, but does not change history state. Useful when parsing faulty variations in KJD
Types
t()
t() :: %Go.Game{black_captures: integer, consecutive_passes: integer, current_board: Go.Board.t, is_over: boolean, komi: float, placements: list, size: integer, turns: [Go.Turn.t], white_captures: integer, winner: Go.Board.color | :none}
Functions
add_move(game, move)
add_move(t, {Go.Board.coordinate, Go.Board.color}) :: {:ok, t} | {:error, String.t}
Add move to a game.
Pass move.
place_stone(game, coordinate, color, force \\ false)
place_stone(t, Go.Board.coordinate, Go.Board.color, boolean) :: {:ok, t} | {:error, String.t}
place_stones(game, list, color)
place_stones(t, Go.Board.list_of_coordinates, Go.Board.color) :: {:ok, t} | {:error, String.t}
Remove the stone at the given location.
Resign the game, status will change to is_over