chex v0.1.2 Chex.Game

Functions for playing a chess game.

Link to this section Summary

Link to this section Types

Link to this type

t()

t() :: %Chex.Game{
  active_color: term(),
  board: term(),
  captures: term(),
  castling: term(),
  en_passant: term(),
  fen: term(),
  fullmove_clock: term(),
  halfmove_clock: term(),
  moves: term()
}

Link to this section Functions

Link to this function

move(game, move)

move(Chex.Game.t(), Chex.Game.move() | String.t()) ::
  Chex.Game.t() | {:error, atom()}
Link to this function

new(fen \\ "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")

new(String.t()) :: Chex.Game.t()

Creates a new game from fen.

Returns a %Chex.Game{} initialized with fen or the default starting positions.

Examples

iex> Chex.Game.new() %Chex.Game{} iex> Chex.Game.new("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1") %Chex.Game{}

Link to this function

to_fen(game)

to_fen(Chex.Game.t()) :: String.t()