niklasf/shakmaty
소개
A Rust library for chess and chess variant rules and operations
게임 및 에뮬레이션What you can do
- Generate legal moves: use shakmaty::{Chess, Position}; let pos = Chess::default(); let legals = pos.legal_moves(); assert_eq!(legals.len(), 20);
- Play moves: 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 FEN, SAN and UCI notation.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalshakmaty
A Rust library for chess and chess variant rules and operations
Features
Generate legal moves:
use shakmaty::{Chess, Position}; let pos = Chess::default(); let legals = pos.legal_moves(); assert_eq!(legals.len(), 20);Play moves:
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 FEN, SAN and UCI notation.
Supports all Lichess variants: Standard chess, Chess960, Antichess, Atomic, King of the Hill, Three-Check, Crazyhouse, Racing Kings and Horde.
Bitboards and attack generation with compact fixed shift magic attack tables or Hyperbola Quintessence.
Fast compact binary encodings for positions and moves.
Zobrist hash positions.
Probe Syzygy tablebases with shakmaty-syzygy.
Parse PGN files with pgn-reader (experimental).
Documentation
Performance
Expect move generation performance in the ballpark of the world's best chess engines.
Simple perft speed can give a rough indication, but only that -- for example, Stockfish maintains additional data structures for evaluation (and newer Stockfish versions put even less emphasis on perft speed).
Here is a snapshot at a point in time. No hashtables. i7-6850K CPU @ 3.60GHz.
| perft | 4 | 5 |
|---|---|---|
| shakmaty 0.16.0 | 1.0 ms | 24.1 ms |
| jordanbray/chess 3.1.1 | 0.8 ms | 18.6 ms |
| Stockfish 8 (x86-64-bmi2) | 4 ms | 33 ms |
License
shakmaty is licensed under the GPL-3.0 (or any later version at your option). See the COPYING file for the full license text.
관련 프로젝트 살펴보기
불러오는 중…