Turncoat: An elegant UCI chess engine

I am pleased to announce the first release for Turncoat, a recently developed bitboard based chess engine, also available via Hackage.

One of the main motivations for this project, which is still at an early stage, was to prove that it is possible to write a relatively high level declarative program that can achieve a certain level of performance that is able to at least compete against similar projects written in a much more imperative fashion, usually in either Rust, C++ or C.

This also highlights the high ceiling in terms of performance that GHC enables, without having to compromise on modularity or readability, when carefully accounting for strictness, specialization, inlining and compiler flags.

There are still many potential improvements, specially in areas like move ordering and evaluation that could greatly increase the engine playing strength, so if you have any concrete ideas, please feel free to let me know here or open an issue on the repository.

Likewise, let me know if you think some of the code could be optimised to avoid unnecessary closures at runtime, or just achieve better performance in general.

22 Likes

Thanks for posting this! I’m learning a ton looking at your code for this.

SPECIALIZE is new to me, for example.

1 Like

Thanks. From the start of the project there was a big focus on readability from both a maintainability standpoint and also so that it can be used as a sort of reference implementation for chess engines / high performance applications in Haskell, so I’m glad you found it useful.

On the topic of specialization, among many others, I can’t recommend highly enough the Well-Typed blogposts and the recent Unfolder series.

3 Likes

Very cool, I’ll be following the progress and hopefully learn something along the way :smiley: Commendable you made the code so readable

2 Likes

I now want to make a Geometry based chess engine.

1 Like