Is there a chess engine which you can use regardless of the game's rules? For example, I want to create my own chess version in which queen will also be able to move as knight, or just a 10x10-square version of chess. I am wondering, is there an engine in which I can put "my rules" in, and then not only it will be able to play, but also it will beat any human in that version?

I know that Stockfish is open source, but how easy would it be to edit it according to "your rules?”

If not, when it is expected to happen? I mean during the next 5 years, or after 20 years.

5 Answers 5


Yes, there is. The FairyMax engine is quite flexible, it changes how it plays chess from a configuration text file. Please take a look at the official version:

Do you see Capablanca chess, where the board is bigger? Do you see all those variants?

Some links:

You'll need to learn how to use the file. Please ask on the Winboard forum for any further assistance (I don't think there is proper documentation, you just need to ask). Pay close attention to H.G.Muller, he is the man who did all of that.

Stockfish doesn't allow easy transition to a variant. It's still possible but you'll need to battle at the source code level. Not simple. Nothing will change unless you rewrite Stockfish from scratch. Use Winboard/Fairymax, not Stockfish. Winboard/Fairymax is the best variant engine available.

  • Could FairyMax accommodate alternate rules like "If the king can move one square forward, it must; otherwise make any legal move" or "If it is possible to move or capture any pawn, player must do so; otherwise make any legal move"?
    – supercat
    Commented Mar 14, 2018 at 23:28
  • @supercat Ask on the forum.
    – SmallChess
    Commented Mar 15, 2018 at 0:45

Just a random pointer. There is a 15-year old commercial Windows program called Zillions of Games that allows one to define arbitrary board games (using a simple scripting language), and includes an AI that plays them (or at least tries to). I have never used it myself, but a friend of mine was a fan and thought that the AI was not bad for what it did. (though surely not Stockfish-level).

The site seems to be still online, and at least the demo can be downloaded.

  • 1
    I've used Zillions of Games many years ago, and even encoded a chess variant with IIRC 52 squares. It was a decent program, but I don't think it's been updated to take advantage of 64-bit processors.
    – supercat
    Commented Mar 14, 2018 at 23:30
  • 1
    chessv.org is a clone of Zillions with source code. Includes the FairyMax Universal Engine by Muller. Commented Jul 7, 2018 at 9:12

Fairy-Max, Sjaak II, and Nebiyu Alien all allow configuration of new variants to some extent, and already out-of-the-box support a large variety of chess variants. They can e.g. be used with the XBoard/WinBoard GUI.

Since you explicitly mentioned Stockfish, I would like to add that I recently started to develop the fork Fairy-Stockfish that is quite flexible with regard to the addition of new variants. It is still in an early stage of development, so it is not as flexible as the aforementioned alternatives yet, and the addition of new variants can not yet be done via a configuration file (UPDATE 2019/09: user-defined variants via a configuration file are supported now), but via a configuration-like file in the code. The main limitation is that only board sizes equal to or smaller than 12x10 are supported. Its main advantage is that its playing strength is quite high compared to other chess variant engines, since it is based on Stockfish. You can also play some of the variants online against it on pychess-variants.

The variant you mentioned where the queen can also move as a knight is called amazon chess and is already supported by Fairy-Stockfish. By a 10x10 version of chess, are you referring to something like Grand chess?


I am not aware of any such thing existing.

To some extent it is possible to program an engine that can take custom rules. However, naturally, you would have to decide beforehand on what kind of customizations you want to allow: e.g. customizing the movement of pieces, the board size....

As for your second request (it will beat any human in that version), this is impossible with traditional chess engines, because they rely heavily on evaluation functions which are specific and finely tuned to the specific variant of chess. For instance (just one example), if you let the queen move like a knight it would change its material value to some unknown number.

The second part could probably be solved in alpha zero type of chess engines, but those are not available yet for the general publice, as far as I am aware.


I'm not sure if there is one already out there, but here are some issues to consider.

An engine has two main tasks: generating positions, and evaluating positions. It shouldn't be too hard in principle to create an engine that allows modifications to the rules and generates the positions; the search algorithm itself is pretty generic. The evaluation of the position is trickier since it tends to based on heuristics such as piece value, space, king safety, etc. which have been developed over the years for standard chess. The existing heuristics would likely be suboptimal for your variant, so you'd need to come up with them yourself if you don't want your engine to be too naive about strategy.

An engine such as Google AlphaZero doesn't need the heuristics because it can "discover" them by training, playing many times against itself. That would be an interesting way of implementing engines for chess variants, but I don't think it's readily available. Maybe some more lightweight machine-learning alternatives exist.

A caveat of traditional engines such as Stockfish is that they have been heavily optimized to save memory and time, and some of these optimizations might make drastic rule changes difficult. But if this is just for fun and research, a simpler, less optimized engine seems feasible and could be developed pretty quickly by a motivated programmer (shouldn't take years).

  • 2
    There is one out there. I'll post my answer.
    – SmallChess
    Commented Mar 5, 2018 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.