A Rust library for chess move generation
Generate legal moves:
```rust use shakmaty::{Chess, Position};
let pos = Chess::default(); let legals = pos.legals(); assert_eq!(legals.len(), 20); ```
Play moves:
```rust use shakmaty::{Square, Move, Role};
// 1. e4 let pos = pos.play(&Move::Normal { role: Role::Pawn, from: Square::E2, to: Square::E4, capture: None, promotion: None, })?; ```
Detect game end conditions: pos.is_checkmate()
, pos.is_stalemate()
,
pos.is_insufficient_material()
, pos.outcome()
.
Read and write FENs, SANs and UCIs.
Supports Standard chess and Chess960. Provides vocabulary to implement other variants.
Bitboards and compact fixed shift magic attack tables.
#[repr(i8)]
for Square
. Implement all lossless integer
conversions From<Square>
.Square::flip_horizontal()
, flip_vertical()
and flip_diagonal()
.CarryRippler::last()
by @nvzqz.Square
is now a #[repr(u8)]
enum.bitflags
for PositionError
.RemainingChecks::subtract()
to decrement()
.Position::swap_turn()
.Shakmaty is licensed under the GPL-3.0 (or any later version at your option). See the COPYING file for the full license text.