33 releases
Uses new Rust 2024
| 0.9.0 | Jan 1, 2025 |
|---|---|
| 0.8.2 | Nov 29, 2020 |
| 0.7.8 | Nov 25, 2020 |
| 0.7.0 | Jul 17, 2020 |
| 0.3.3 | Mar 30, 2017 |
#1427 in Game dev
2,000 downloads per month
3MB
114K
SLoC
Fast chess move generation library. Uses SIMD for fast sliding piece move generation
Example usage:
use chess_move_gen::*;
let mut list = MoveVec::new();
let position = &Position::from_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w QqKk - 0 1").unwrap();
legal_moves::<MoveVec>(position, &mut list);
assert_eq!(list.len(), 20);
Ways to store moves:
MoveVec: Wraps a vector of generated moves, useful if you need to access the actual moves being generated
MoveCounter: Counts moves of each kind (captures, castles, promotions etc). Useful if you are making a perft function or need statistics about moves for a position, but don't care about the actual moves
SortedMoveAdder + SortedMoveHeap: Stores genarated moves in a sorted binary heap, which are efficiently ordered as they are inserted based on a heuristic scoring and piece-square table that you provide. Use this if you want the moves to have a reasonably good initial ordering so moves that are checked first are more likely to lead to eg alpha-beta cutoffs and reduce the search tree size.
Dependencies
~470KB