Skip to main content

Crate lazychess

Crate lazychess 

Source
Expand description

§LazyChess

A fast, memory-efficient chess engine library for Rust.

LazyChess implements all standard FIDE rules, including castling, en passant, pawn promotion, and every draw condition (fifty-move rule, threefold repetition, insufficient material). It also supports FEN / PGN serialisation, UCI communication, and an optional opening book.

§Quick start

use lazychess::Game;

let mut game = Game::new();
game.do_move("e2e4").unwrap();
game.do_move("e7e5").unwrap();
game.do_move("g1f3").unwrap(); // Nf3

println!("{}", game.display_board());
println!("Status : {}", game.get_game_status_str());
println!("FEN    : {}", game.get_fen());
println!("PGN    : {}", game.get_pgn());

Re-exports§

pub use types::ChessError;
pub use types::ChessResult;
pub use types::Color;
pub use types::DrawReason;
pub use types::GameStatus;
pub use types::Move;
pub use types::MoveFlag;
pub use types::Piece;
pub use types::PieceType;
pub use types::Square;
pub use types::CastlingRights;
pub use types::file_of;
pub use types::rank_of;
pub use types::make_square;
pub use types::square_name;
pub use types::parse_square;
pub use board::Board;
pub use game::Game;
pub use movegen::is_in_check;
pub use movegen::is_square_attacked;
pub use movegen::apply_move;
pub use fen::board_to_fen;
pub use fen::parse_fen;
pub use pgn::move_to_san;
pub use pgn::moves_to_pgn;
pub use pgn::parse_pgn;
pub use opening::OpeningBook;

Modules§

board
fen
game
movegen
opening
pgn
types
uci
UCI Engine Communication