Answers.Body: <p>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:</p>
  
  <ul>
  <li><a href="http://home.hccnet.nl/h.g.muller/fmax.ini" rel="noreferrer">http://home.hccnet.nl/h.g.muller/fmax.ini</a></li>
  </ul>
  
  <p>Do you see Capablanca chess, where the board is bigger? Do you see all those variants?</p>
  
  <p>Some links:</p>
  
  <ul>
  <li><a href="http://www.open-aurec.com/wbforum/viewtopic.php?f=19&amp;t=53353" rel="noreferrer">http://www.open-aurec.com/wbforum/viewtopic.php?f=19&amp;t=53353</a></li>
  <li><a href="http://www.open-aurec.com/wbforum/viewtopic.php?f=2&amp;t=53826" rel="noreferrer">http://www.open-aurec.com/wbforum/viewtopic.php?f=2&amp;t=53826</a></li>
  </ul>
  
  <p>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.</p>
  
  <p>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, <strong>not</strong> Stockfish. Winboard/Fairymax is the best variant engine available.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-14T23:28:26.273Z
Answers.Text: 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"?
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-15T00:45:40.317Z
Answers.Text: @supercat Ask on the forum.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-05T23:01:29.943Z
Answers.LastActivityDate: 2018-03-05T23:01:29.943Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>Just a random pointer. There is a 15-year old commercial Windows program called <a href="https://en.wikipedia.org/wiki/Zillions_of_Games" rel="nofollow noreferrer">Zillions of Games</a> 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).</p>
  
  <p>The site seems to be still online, and at least the demo can be downloaded.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-14T23:30:17.373Z
Answers.Text: 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.
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-07T09:12:13.163Z
Answers.Text: http://www.chessv.org/ is a clone of Zillions with source code.  Includes the FairyMax Universal Engine by Muller.
Answers.UserDisplayName: Fred Knight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-06T19:10:33.013Z
Answers.LastActivityDate: 2018-03-06T19:10:33.013Z
Answers.UserDisplayName: Federico Poloni
Answers.Body: <p><a href="http://home.hccnet.nl/h.g.muller/CVfairy.html" rel="nofollow noreferrer">Fairy-Max</a>, <a href="http://www.eglebbk.dds.nl/program/chess-index.html" rel="nofollow noreferrer">Sjaak II</a>, and <a href="https://sites.google.com/site/dshawul/home" rel="nofollow noreferrer">Nebiyu Alien</a> 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 <a href="http://hgm.nubati.net/" rel="nofollow noreferrer">XBoard/WinBoard GUI</a>.</p>
  
  <p>Since you explicitly mentioned Stockfish, I would like to add that I recently started to develop the fork <a href="https://github.com/ianfab/Fairy-Stockfish" rel="nofollow noreferrer">Fairy-Stockfish</a> 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: <a href="https://github.com/ianfab/Fairy-Stockfish/blob/master/src/variants.ini" rel="nofollow noreferrer">user-defined variants via a configuration file</a> are supported now), but via a <a href="https://github.com/ianfab/Fairy-Stockfish/blob/master/src/variant.cpp" rel="nofollow noreferrer">configuration-like file in the code</a>. 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 <a href="https://pychess-variants.herokuapp.com/" rel="nofollow noreferrer">pychess-variants</a>.</p>
  
  <p>The variant you mentioned where the queen can also move as a knight is called <a href="https://www.chessvariants.com/diffmove.dir/amazone.html" rel="nofollow noreferrer">amazon chess</a> and is already supported by Fairy-Stockfish. By a 10x10 version of chess, are you referring to something like <a href="https://en.wikipedia.org/wiki/Grand_Chess" rel="nofollow noreferrer">Grand chess</a>?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-07T08:46:22.090Z
Answers.LastActivityDate: 2019-09-02T09:33:40.470Z
Answers.LastEditDate: 2019-09-02T09:33:40.470Z
Answers.UserDisplayName: Fabian Fichter
Answers.Body: <p>I'm not sure if there is one already out there, but here are some issues to consider.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-05T22:50:51.337Z
Answers.Text: There is one out there. I'll post my answer.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-05T22:50:15.477Z
Answers.LastActivityDate: 2018-03-05T22:50:15.477Z
Answers.UserDisplayName: itub
Answers.Body: <p>I am not aware of any such thing existing. </p>
  
  <p>To some extent it is possible to program an engine that can take custom rules. However, naturally, you would have to decide <em>beforehand</em> on what kind of customizations you want to allow: e.g. customizing the movement of pieces, the board size.... </p>
  
  <p>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.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-05T22:33:10.987Z
Answers.LastActivityDate: 2018-03-05T22:33:10.987Z
Answers.UserDisplayName: user1583209
Body: <p>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?</p>
  
  <p>I know that Stockfish is open source, but how easy would it be to edit it according to "your rules?”</p>
  
  <p>If not, when it is expected to happen? I mean during the next 5 years, or after 20 years.</p>
  
Tags: <engines><rules><stockfish>
Title: Custom chess (game) engine
ThreadText: # Custom chess (game) engine
  
  (Asked by: username_0 on 2018-03-05)
  
  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.
  
  **Tags:** engines, rules, stockfish
  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_1 on 2018-03-05. Score: 10
  
  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:
  
  * <http://home.hccnet.nl/h.g.muller/fmax.ini>
  
  Do you see Capablanca chess, where the board is bigger? Do you see all those variants?
  
  Some links:
  
  * <http://www.open-aurec.com/wbforum/viewtopic.php?f=19&t=53353>
  * <http://www.open-aurec.com/wbforum/viewtopic.php?f=2&t=53826>
  
  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.
  
  > **Comments:**
  > **username_2**: 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"?  
  > **username_1**: @username_2 Ask on the forum.  
  
  ---
  
  ### Answer by username_3 on 2018-03-06. Score: 3
  
  Just a random pointer. There is a 15-year old commercial Windows program called [Zillions of Games](https://en.wikipedia.org/wiki/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.
  
  > **Comments:**
  > **username_2**: 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.  
  > **username_4**: http://www.chessv.org/ is a clone of Zillions with source code.  Includes the FairyMax Universal Engine by Muller.  
  
  ---
  
  ### Answer by username_5 on 2018-07-07. Score: 2
  
  [Fairy-Max](http://home.hccnet.nl/h.g.muller/CVfairy.html), [Sjaak II](http://www.eglebbk.dds.nl/program/chess-index.html), and [Nebiyu Alien](https://sites.google.com/site/dshawul/home) 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](http://hgm.nubati.net/).
  
  Since you explicitly mentioned Stockfish, I would like to add that I recently started to develop the fork [Fairy-Stockfish](https://github.com/ianfab/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](https://github.com/ianfab/Fairy-Stockfish/blob/master/src/variants.ini) are supported now), but via a [configuration-like file in the code](https://github.com/ianfab/Fairy-Stockfish/blob/master/src/variant.cpp). 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](https://pychess-variants.herokuapp.com/).
  
  The variant you mentioned where the queen can also move as a knight is called [amazon chess](https://www.chessvariants.com/diffmove.dir/amazone.html) and is already supported by Fairy-Stockfish. By a 10x10 version of chess, are you referring to something like [Grand chess](https://en.wikipedia.org/wiki/Grand_Chess)?
  
  
  ---
  
  ### Answer by username_6 on 2018-03-05. Score: 1
  
  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).
  
  > **Comments:**
  > **username_1**: There is one out there. I'll post my answer.  
  
  ---
  
  ### Answer by username_7 on 2018-03-05. Score: 1
  
  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.
  
  
  ---
  
  