Chess implemented entirely in the Rust (and Typescript) type systems
Chess, a classic game loved by many, has been implemented entirely in the Rust and Typescript type systems. This impressive feat showcases the power and flexibility of these languages' type systems.
The implementation includes the ability to generate a list of legal moves and play them by specifying the start and end square. The programs cover all chess rules except for draws by repetition and the 50 move rule.
The Rust implementation, in particular, stands out as one of the most complex programs implemented in the Rust type system. It pushes the boundaries of what can be achieved with Rust's type system.
The Typescript implementation also deserves recognition, as it demonstrates the capabilities of the Typescript type system in handling complex projects.
Developers interested in exploring these implementations can check out the repositories for both the Rust and Typescript versions. The code provides examples of how to use the implementations and even includes a FEN parser for the Typescript version.
While the implementations are impressive, it's worth noting that they may still contain bugs. The author welcomes feedback and contributions from the community to improve the programs.
In terms of performance, both implementations are relatively slow. The Typescript test suite takes around 30 seconds to run, while the Rust test suite takes approximately 10 minutes. The Rust implementation's performance is slightly better, except for the complex pawn moves, which may pose some challenges for the compiler.
Overall, this project serves as an inspiration for developers interested in exploring the capabilities of type systems in programming languages like Rust and Typescript. It showcases the potential for leveraging type systems to build complex applications and games.