game

Types

pub type Game {
  Game(
    board: BoardBB,
    turn: Color,
    history: List(Move),
    status: Status,
    ply: Int,
    white_king_castle: Bool,
    white_queen_castle: Bool,
    black_king_castle: Bool,
    black_queen_castle: Bool,
    en_passant: Option(Position),
  )
}

Constructors

  • Game(
      board: BoardBB,
      turn: Color,
      history: List(Move),
      status: Status,
      ply: Int,
      white_king_castle: Bool,
      white_queen_castle: Bool,
      black_king_castle: Bool,
      black_queen_castle: Bool,
      en_passant: Option(Position),
    )
pub type Message {
  AllLegalMoves(reply_with: Subject(List(Move)))
  ApplyMove(reply_with: Subject(Game), move: Move)
  ApplyMoveUCI(reply_with: Subject(Game), move: String)
  Shutdown
  PrintBoard(reply_with: Subject(Nil))
}

Constructors

  • AllLegalMoves(reply_with: Subject(List(Move)))
  • ApplyMove(reply_with: Subject(Game), move: Move)
  • ApplyMoveUCI(reply_with: Subject(Game), move: String)
  • Shutdown
  • PrintBoard(reply_with: Subject(Nil))
pub type Status {
  Checkmate
  Stalemate
  InProgress
}

Constructors

  • Checkmate
  • Stalemate
  • InProgress

Functions

pub fn all_legal_moves(
  game_actor: Subject(Message),
) -> List(Move)
pub fn apply_move(
  game_actor: Subject(Message),
  move: Move,
) -> Game
pub fn apply_move_uci(
  game_actor: Subject(Message),
  move_uci: String,
) -> Game
pub fn new_game() -> Subject(Message)
pub fn new_game_from_fen(fen_string: String) -> Subject(Message)
pub fn print_board(game_actor: Subject(Message)) -> Nil
pub fn print_board_from_fen(fen: String) -> Nil
Search Document