Skip to content

Repository files navigation

OrbisChessEngine.jl

Stable Documentation Development documentation Test workflow status Coverage Aqua SciML Code Style BestieTemplate

Orbis Logo

A Julia package that implements chess from scratch alongside a chess engine, Orbis. It provides functionalities to represent the chessboard, validate moves, and evaluate positions. Particularly, OrbisChessEngine implements:

  • All chess rules
  • Bitboard representation
  • Legal move generation (tested with perft)
  • FEN parsing
  • Opening book support
  • Minimax search with alpha–beta pruning, iterative deepening, quiescence search, transposition tables, null move pruning, and move ordering heuristics
  • Evaluation function based on piece-square tables

Installation

OrbisChessEngine can be installed directly from the Julia package manager. In the Julia REPL, press ] to enter the Pkg mode, then run:

pkg> add OrbisChessEngine

Example

Here we show an example of how to let the engine play a "1+1" game against itself and plot it afterwards to view it.

game = Game("1+1")
plots = []
while game_status(game.board) == :ongoing
    engine_move!(game)
    push!(plots, display(game))
end

for i in eachindex(plots)
    sleep(0.5)
    display(plots[i])
end

Resources

View the documentation at https://BjarkeHautop.github.io/OrbisChessEngine.jl/dev/.

Visit chess programming wiki for useful articles on chess engine programming: https://www.chessprogramming.org/Main_Page.

TODO

  • Improve search performance by minimizing allocations

  • Improve evaluation function (e.g. add pawn structure, king safety, trapped pieces, etc.)

  • Add support for multiple threads in search (e.g. lazy SMP)

  • Implement (some of) UCI protocol

  • Make executable with PackageCompiler.jl

  • Add magic bitboards for faster move generation (added for bishops, but not yet used. Minimal performance improvement observed - see Benchmarks for details.)

  • Implement into Lichess bot (see https://github.com/lichess-bot-devs/lichess-bot)

Releases

Packages

Contributors

Languages