Crate pleco [−] [src]
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 pleco_engine.
Usage
This crate is on crates.io and can be
used by adding pleco
to the dependencies in your project's Cargo.toml
.
pleco
requires nightly rust currently, so make sure your toolchain is a nightly version.
Examples
You can create a Board
with the starting position like so:
use pleco::Board; let board = Board::default();
Generating a list of moves (Contained inside a MoveList
) can be done with:
let list = board.generate_moves();
Applying and undoing moves is simple:
let mut board = Board::default(); let list = board.generate_moves(); for mov in list.iter() { board.apply_move(*mov); println!("{}",board.get_fen()); board.undo_move(); }
Using fen strings is also supported:
let start_position = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; let board = Board::new_from_fen(start_position);
Reexports
pub use board::Board; |
pub use core::piece_move::BitMove; |
pub use core::move_list::MoveList; |
pub use core::sq::SQ; |
pub use core::bitboard::BitBoard; |
pub use core::Player; |
pub use core::Piece; |
pub use core::Rank; |
pub use core::File; |
Modules
board |
This module contains |
bot_prelude |
Easy importing of all available bots. |
bots |
Contains all of the currently completed standard bots/searchers/AIs. |
core |
Contains various components and structures supporting the creation of a chessboard. This
includes |
tools |
Miscellaneous tools for used for Searching. Most notably this module
contains the |