chess-lab 0.2.0

Chess library with multiple variants and FEN/PGN support.
Documentation

Chess Lab

Crates.io Docs.rs License Actions Status

Description

Chess Lab is a comprehensive chess library written in rust that supports multiple game variants along with FEN and PGN notations. It offers a straightforward API for seamless interaction with the game, enabling developers to integrate chess functionalities into their applications effortlessly. Additionally, it provides the capability to save and retrieve multiple game lines, facilitating the management of complex game scenarios.

Examples

Standard Chess

use chess_lab::variants::StandardChess;

let mut game = StandardChess::default();
game.move_piece("e4").unwrap();
game.move_piece("e5").unwrap();

assert!(game.pgn().contains("1. e4 e5"));

From FEN (Position-Based)

use chess_lab::core::VariantBuilder;
use chess_lab::variants::StandardChess;

let fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
let game = StandardChess::from_fen(fen).unwrap();

assert_eq!(game.fen(), fen);

Chess960

use chess_lab::variants::Chess960;

let game = Chess960::default();
let fen = game.fen();

assert!(fen.contains(" w KQkq - 0 1"));

Read PGN File

use chess_lab::core::VariantBuilder;
use chess_lab::variants::StandardChess;

let game = StandardChess::load("data/standard/ex1.pgn").unwrap();
assert!(game.pgn().contains("1. e4"));

Installation

Add the following dependency to your Cargo.toml file:

[dependencies]
chess-lab = "0.2.2"

Project documentation

https://deepwiki.com/Santicm23/chess-lab

Features

  • Playable Chess game
  • FEN/PGN support
  • Multiple game lines
  • Multiple variants
  • Chess engine

Variants

  • Standard Chess
  • Position-Based Chess
  • Chess960
  • Three-Check
  • Antichess
  • Horde
  • Duck Chess
  • Racing Kings
  • King of the Hill
  • Crazyhouse
  • Atomic

Created by