game

Types

pub type DrawReason {
  Stalemate
  FiftyMoveRule
  ThreefoldRepetition
  InsufficientMaterial
  Manual
}

Constructors

  • Stalemate
  • FiftyMoveRule
  • ThreefoldRepetition
  • InsufficientMaterial
  • Manual
pub type Game {
  Game(
    board: BoardBB,
    turn: Color,
    history: List(Move),
    status: Option(Status),
    ply: Int,
    fifty_move_rule: Int,
    white_kingside_castle: CastleRights,
    white_queenside_castle: CastleRights,
    black_kingside_castle: CastleRights,
    black_queenside_castle: CastleRights,
    en_passant: Option(Position),
  )
}

Constructors

  • Game(
      board: BoardBB,
      turn: Color,
      history: List(Move),
      status: Option(Status),
      ply: Int,
      fifty_move_rule: Int,
      white_kingside_castle: CastleRights,
      white_queenside_castle: CastleRights,
      black_kingside_castle: CastleRights,
      black_queenside_castle: CastleRights,
      en_passant: Option(Position),
    )
pub type Status {
  Draw(reason: DrawReason)
  Win(winner: Color, reason: String)
  InProgress
}

Constructors

  • Draw(reason: DrawReason)
  • Win(winner: Color, reason: String)
  • InProgress
pub type WinReason {
  Checkmate
  Resignation
  Timeout
}

Constructors

  • Checkmate
  • Resignation
  • Timeout

Functions

pub fn all_legal_moves(game: Game) -> List(Move)
pub fn apply_move(game: Game, move: Move) -> Game
pub fn apply_move_uci(game: Game, move: String) -> Game
pub fn print_board(game: Game) -> Nil
pub fn print_board_from_fen(fen: String) -> Nil
pub fn to_fen(game: Game) -> String
pub fn undo_move(game: Game) -> Game
Search Document