FischerCore is a Swift library that encapsulates the core logic and data structures necessary for building chess games.
Named in honor of the legendary chess grandmaster Bobby Fischer, this library provides a comprehensive foundation for creating, managing, and enforcing the rules of chess
It also powers the MindChess project as its chess logic core: https://nsstudent.dev/MindChessLanding/
You can use FischerCore in your project by adding it as a dependency in your Package.swift file:
.package(url: "https://github.com/NSStudent/fischer-core.git", from: "0.1.0")Then, add "FischerCore" to your target's dependencies:
.target(
name: "YourTarget",
dependencies: [
.product(name: "FischerCore", package: "fischer-core")
]
)The API reference and detailed documentation for FischerCore is available at:
👉 https://nsstudent.dev/fischer-core/documentation/fischercore/
This library is based on the code of other well-crafted chess engines and bitboard libraries in Swift. Notably, it builds upon the work in Sage by @nvzqz, adapting and updating it to be compatible with the current state of the Swift language and modern development practices.
Special thanks to Point-Free for their fantastic swift-parsing library, which greatly simplified the implementation of our PGN parser.
The following features are planned to improve the functionality and completeness of FischerCore:
-
BasicPGNParser - Tests with some TWIC pgn files
- Add performance benchmarks for parsers and move generation.
- Improve FEN parsing using a unified parser approach.
The following core features are already available:
Bitboard & tables: Dense bitboard representation with precomputed attack masks (king, knight, pawn, lines) for fast move queries and between/line lookup tables.Game: Rule-enforced move execution (castling, en passant, promotion), move history with undo, outcome detection, threefold/50-move counters, and FEN-based initialization.Moves:SANMove↔Movebridge so PGN moves can be executed insideGame, plus tokenized positions for quick state comparison.PGN parsing: Full game parsing intoPGN,PGNGame, andPGNElementwith tags, variations, NAG evaluations, and rich comments.Comment types: Text, arrows, highlighted squares, clock time ([%clk ...]), elapsed move time ([%emt ...]), and engine evaluation ([%eval ...]) comments are parsed and preserved.
