Skip to content

Lars-Schumann/schach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

229 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schach

A chess simulator, legal move generator, and notation parser with a focus on simplicity and correctness.

#![no_std] compatible, #![forbid_unsafe}] completely safe and 0 hard dependencies.

This Crate relies on several unstable features, mainly for const Traits and Generators.

Example

use schach::game::{GameState, StepResult};
use schach::notation::algebraic::san;

let game = GameState::INITIAL;
// or from a FEN String
// let game = GameState::try_from_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1").unwrap();

let legal_moves = game.core.legal_moves();

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors