Skip to content

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.

License

Notifications You must be signed in to change notification settings

NSStudent/fischer-core

Repository files navigation

FischerCore Logo

Fischer-core

codecov

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/

Swift Package Manager

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")
    ]
)

Documentation

The API reference and detailed documentation for FischerCore is available at:

👉 https://nsstudent.dev/fischer-core/documentation/fischercore/

References

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.

Acknowledgements

Special thanks to Point-Free for their fantastic swift-parsing library, which greatly simplified the implementation of our PGN parser.

Roadmap

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.

✅ What's Implemented

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: SANMoveMove bridge so PGN moves can be executed inside Game, plus tokenized positions for quick state comparison.
  • PGN parsing: Full game parsing into PGN, PGNGame, and PGNElement with 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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Languages