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.
Probe Syzygy tablebases with shakmaty-syzygy.
Giveaway
and Atomic
chess variants.Move.is_zeroing()
.InvalidSquareName
, InvalidUci
, InvalidSan
)
completely public.attacks::bishop_mask
and attacks::rook_mask
.impl From<Move> for Uci
into uci()
and chess960_uci()
.Position.is_chess960()
, Bitboard.without_all()
, Role.upper_char()
, Board.stepper()
.Uci::to_move()
for en passant moves. Thanks zxqfl.u64
instead of usize
for perft()
.InvalidSquareName
.CastlingSide.is_{queen|king}_side()
, San.matches()
, Move.is_capture()
, Move.is_promotion()
, Move.castling_side()
, Position.is_check()
.Ord
and PartialOrd
for Role
.option_filter
feature.option_filter
feature.Color::from_bool()
to Color::from_white()
,
add Color::from_black()
.Move::role()
, Move::is_en_passant()
and Move::is_castle()
.Position::en_passant_moves()
and Position::capture_moves()
.BitXor<bool>
for Color
.FusedIterator
and TrustedLen
on Bitboard
.#[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.