[][src]Crate pleco

A blazingly fast chess library.

This package is separated into two parts. Firstly, the board representation & associated functions (the current crate, pleco), and secondly, the AI implementations using these chess foundations, pleco_engine.

The general formatting and structure of the library take heavy influence from the basic building blocks of the Stockfish chess engine.


This crate is on crates.io and can be used by adding pleco to the dependencies in your project's Cargo.toml.


pleco is currently tested and created for use with the x86_64 instruction set in mind. Currently, there are no guarantees of correct behavior if compiled for a different instruction set.

Nightly Features

If on nightly rust, the feature nightly is available. This enables some nightly optimizations and speed improvements.


While generally a safe library, pleco was built with a focus of speed in mind. Usage of methods must be followed carefully, as there are many possible ways to panic unexpectedly. Methods with the ability to panic will be documented as such.


You can create a Board with the starting position like so:

This example is not tested
use pleco::Board;
let board = Board::start_pos();

Generating a list of moves (Contained inside a MoveList) can be done with:

This example is not tested
let list = board.generate_moves();

Applying and undoing moves is simple:

This example is not tested
let mut board = Board::start_pos();
let list = board.generate_moves();

for mov in list.iter() {

Using fen strings is also supported:

This example is not tested
let start_position = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
let board = Board::from_fen(start_position).unwrap();


pub use board::Board;
pub use core::piece_move::BitMove;
pub use core::piece_move::ScoringMove;
pub use core::move_list::MoveList;
pub use core::move_list::ScoringMoveList;
pub use core::sq::SQ;
pub use core::bitboard::BitBoard;
pub use helper::Helper;
pub use core::Player;
pub use core::Piece;
pub use core::PieceType;
pub use core::Rank;
pub use core::File;



This module contains Board, the object representing the current state of a chessboard. All modifications to the current state of the board is done through this object, as well as gathering information about the current state of the board.


Easy importing of all available bots.


Contains all of the currently completed standard bots/searchers/AIs.


Contains various components and structures supporting the creation of a chessboard. This includes SQ, BitBoard, Player, Piece, GenTypes, Rank, and File.


Statically initialized lookup tables.


Miscellaneous tools for used for Searching. Most notably this module contains the TranspositionTable, a fast lookup table able to be accessed by multiple threads. Other useful objects are the UciLimit enum and Searcher trait for building bots.