chessframe
chessframe is a Rust library for working with chess positions, generating psudo-legal moves, and interacting with the UCI protocol. It provides efficient tools for move generation and board manipulation.
Features
- Load positions from FEN strings.
- Generate psudo-legal moves efficiently.
Examples
Loading a position from a FEN string
Creating a Board from a FEN string is easy with the Board::from_fen() constructor. The Board::default() method constructs the starting position using the standard starting FEN.
use Board;
let fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
let board = from_fen;
Making a Move
This example demonstrates how to make a move on the chessboard. Since Board does not maintain move history, you need to use board.make_move_new() to create a new board instead of modifying the current one. However, in this example, we use board.make_move(), which updates the board state but does not allow undoing the move.
use ;
let mut board = default;
let mv = new;
assert_eq!;
Making and undoing a Move using Game
This example demonstrates how to make and undo a move using the Game struct.
use ;
let mut game = new;
let mv = new;
assert_eq!;
assert_eq!;
game.make_move;
assert_eq!;
assert_eq!;
game.undo_move;
assert_eq!;
assert_eq!;
Using make_move_new for Perft Tests
The following example implements a Perft test, which counts all possible positions after a given number of moves.
use ;