Skip to content

Lars-Schumann/schach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

239 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schach

A chess simulator, legal move generator, and notation parser with a focus on simplicity and correctness. This Crate relies on several unstable features, mainly for const Traits and Generators.

Example

use schach::game::Game;
use schach::game::StepResult;

fn main() {
    let game = Game::INITIAL;
    // or from a FEN String
    // let game = Game::from_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");

    let legal_moves = game.legal_moves();

    for mv in legal_moves {
        match mv.clone().make() {
            StepResult::Continue(next_game) => {
                println!("Move: {:?} results in {next_game:?}", mv.san());
            }
            StepResult::Break(_game_result) => {}
        }
    }
}

Guarantees

  • #![no_std] compatible
  • #![forbid_unsafe] completely safe
  • 0 hard dependencies
  • every Ongoing Game has at least one legal move
  • starting from a valid Game, one can only reach other valid Games, notably this is implemented without having to re-check the legality of a Move before it is made

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors