3 releases

new 0.1.2 Feb 23, 2025
0.1.1 Feb 23, 2025
0.1.0 Feb 23, 2025

#563 in Game dev

Custom license

49KB
1K SLoC

shax

shax is a work-in-progress chess engine (Docs).

What works now:

  • Move generation and validation
  • Full chess rules support (castling, en passant, promotion, repetition draws, 75-move rule)

Maybe someday:

  • Search algorithm
  • Position evaluation
  • UCI implementation

Example

use shax::board::Board;
use shax::notation::{Color, Move};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let mut board = Board::default();

    for mov in board.color_moves(Color::White) {
        // Every legal move for white
        println!("{mov:?}")
    }

    // Make a move using Long Algrebraic Notation (LAN)
    board.make_move(Move::from_lan("e2e4")?)?;

    // Display current position
    println!("{board:#?}");

    Ok(())
}

lib.rs:

shax

shax is a work-in-progress chess engine (GitHub).

What works now:

  • Move generation and validation
  • Full chess rules support (castling, en passant, promotion, repetition draws, 75-move rule)

Maybe someday:

  • Search algorithm
  • Position evaluation
  • UCI implementation

Example

use shax::board::Board;
use shax::notation::{Color, Move};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let mut board = Board::default();

    for mov in board.color_moves(Color::White) {
        // Every legal move for white
        println!("{mov:?}")
    }

    // Make a move using long algrebraic notation (LAN)
    board.make_move(Move::from_lan("e2e4")?)?;

    // Display current position
    println!("{board:#?}");

    Ok(())
}

Dependencies

~0.3–0.8MB
~18K SLoC