Answers.Body: <p>Currently there is no “easy” way to do exactly this. The “easiest” way in this case would simply be the right way. You would have to learn a coding language and develop a chess computer using an existing neural network technology.</p>
  <p>There are plenty of tutorials online for how to make your own chess computer. You could follow those tutorials, and where it explains how to implement the rules of the game, you would simply implement your own rules in place of the regular chess rules. Once you are finished with creating the game, you would probably want to use NEAT to train an ai to play it. NEAT stands for Neuro Evolution of Augmenting Topologies.</p>
  <p>Before putting this massive amount of effort in, I suggest reading the following study: Assessing Game Balance with AlphaZero: Exploring Alternative Rule Sets in Chess.</p>
  <p>In this study, they forced the DeepMind project to play variants of chess that didn’t really exist. The most interesting variation was one where pawns could move, but not capture, sideways, in addition to their other moves.</p>
  <p>They found that changing the castling rules did not produce much interesting gameplay, though I will note that none of their rules gave the king infinite quasi castling power like you’re describing.</p>
  <p>Perhaps the easiest way to do this would be to use our imagination. I am a variants enthusiast and atomic player so I will give it my best shot.</p>
  <p>The King is the most important piece in the game and defending it is the most important goal, second only to capturing the opponent’s King. This tells me that the most likely application of your rule change would be to defend the king one move before potential checkmate. There would also be special endgame circumstances where once the majority of pieces were off the board, the king would then carry a pawn on its back to promotion. For example, the king could prevent a pawn from ever being on a dark square against a dark square bishop.</p>
  <p>In addition, moves that improve king position and the position of another piece could become strategy. The concept of moving two pieces at once could be seen as overpowered and preferred to the usual methods.</p>
  <p>Finally, the last effect from your rule change could be an increase in king walks. There are a handful of grandmaster games where one side for whatever reason has to get up and run, and after 10 or so king moves finally there is room to breathe to deliver a deadly attack. More movement options for the king would make these oddly long king walks more possible to accomplish.</p>
  <p>In terms of depth, it would be technically deeper than chess since it offers more move possibility. Which giant number to compare to shannons number I wouldn’t know how to calculate.</p>
  <p>If that doesn’t sound interesting to you, how about a variant where any piece can do a neighborly swap? Now that would create a game that looks alien to players.</p>
  <p>All in all the answer to this question is yours to decide, but hopefully this gives you some insight as to what goes into this sort of thing.</p>
  <p>Edit: OP pointed out that this rule change now allows bishops to swap colors. This opens up possibilities for bishops to defend eachother. As early as move 1 you could elect to have two same color bishops.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-07T17:33:55.287Z
Answers.Text: Let me add what I think would be one of the most crucial applications of this rule: The ability to make a light-squared bishop into a dark-squared one or vice versa.
Answers.UserDisplayName: Gaussler
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-07T18:22:06.853Z
Answers.Text: Completely missed this. I think this would be an entertaining variant, and one that would be difficult to master.
Answers.UserDisplayName: Matthew
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-09T09:04:25.503Z
Answers.Text: *Currently there is no “easy” way to do exactly this. The “easiest” way in this case would simply be the right way. You would have to learn a coding language and develop a chess computer using an existing neural network technology.* Is this correct? I have never done that, but I imagine modifying [Lczero's source code](https://github.com/LeelaChessZero/lc0) to change the core rules is much less work than starting development from zero. And you don't mention training time, which rates to be the most expensive part (in terms of time, computing resources, or both).
Answers.UserDisplayName: Federico Poloni
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-13T13:59:19.977Z
Answers.Text: @FedericoPoloni I thought about doing exactly that, but I have no idea how many computer resources it would require to reach an advanced level. How far could you get by letting it run in a cheap work laptop?
Answers.UserDisplayName: Gaussler
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-13T14:20:43.147Z
Answers.Text: @Gaussler I have no idea either; I have no experience in that area unfortunately. Hopefully the training time could be reduced by starting from a network pre-trained for regular chess, since the two games are similar in the end. And I wouldn't use a cheap laptop but rather buy cloud computing resources. From what i can read on the internet about lczero's training, I would guess between 100-1000$ to get to superhuman level, but my estimate could be far off since I know very little about it.
Answers.UserDisplayName: Federico Poloni
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-07T15:50:44.530Z
Answers.LastActivityDate: 2023-07-07T18:25:02.560Z
Answers.LastEditDate: 2023-07-07T18:25:02.560Z
Answers.UserDisplayName: Matthew
Body: <p>I would like to use an AI engine to test how well the following chess variant would work: The rules are as in usual chess, except</p>
  <ol>
  <li>Castling is not possible; instead, the next rule takes its place:</li>
  <li>When the king is not in check, it can perform the following move: It can switch places with any piece of its own colour on the 8 neighbouring squares around it. Unlike castling, this move can be performed as many times throughout the game as you want. The following special rules apply:
  <ul>
  <li>It cannot move itself into check by doing so (surprise!).</li>
  <li>It cannot move pawns to the player’s first rank (where pawns cannot be in ordinary chess either).</li>
  <li>If it moves pawns to the player’s eighth rank, that pawn will be promoted as usual.</li>
  </ul>
  </li>
  <li>Any pawn on the player’s second rank can move one or two pieces forward, even if it has previously moved forward and later been moved back by the king. (This is in order to simplify the game so that you don’t have to remember which of your pawns have moved forward previously.)</li>
  </ol>
  <p>The rules themselves do not really matter much. What I would like to know is how an AI engine would play against itself with this ruleset. Based on this, I hope to be able to make my own (human) assessment about how “deep” this variant is. I suppose it is possible to modify the rules given to engines like AlphaZero, MuZero, and Leela Chess Zero and ask the engine to teach itself the game as usual. But are there other, easier methods that do not require extensive rewritings of complicated engines?</p>
  <p>I am aware of questions like <a href="https://chess.stackexchange.com/questions/41325/how-can-i-get-a-chess-engine-to-play-custom-chess-variants">this one</a> and its answer, but it doesn’t seem that the answer can be adapted to support this variant.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-07T14:59:39.287Z
Comments.Text: @user30536 No, that wasn’t what I meant by the question. What I meant was that I would like to ask the engine to play the game against itself many times in order to study its playing style and how this affects the game tactically. And then, from looking at these games, I would make my own assessment about how “deep” this variant is, from a human perspective. (I updated the question to clarify this.)
Comments.UserDisplayName: Gaussler
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-07T15:25:45.020Z
Comments.Text: Most engines are optimized to play standard chess. Fairy Stockfish supports some variants. If you want to train the engine with self-learning like Leela Zero for custom rules, you need to implement those rules and see how to setup training yourself.
Comments.UserDisplayName: qwr
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-11T08:58:38.193Z
Comments.Text: What exactly do you mean by " how “deep” this variant is."? What is the name of the variant? Is this variant already played elsewhere? Looks like not difficult to implement. But another issue is the GUI. Or you can just play it manually. In a kp vs k ending, the kp will win even if the defending king is in front of the pawn because the king and pawn can just swap at appropriate moment.
Comments.UserDisplayName: ferdy
Tags: <engines><chess-variants><chess-ai>
Title: How to ask an AI engine to test this chess variant?
ThreadText: # How to ask an AI engine to test this chess variant?
  
  (Asked by: username_0 on 2023-07-07)
  
  I would like to use an AI engine to test how well the following chess variant would work: The rules are as in usual chess, except
  
  1. Castling is not possible; instead, the next rule takes its place:
  2. When the king is not in check, it can perform the following move: It can switch places with any piece of its own colour on the 8 neighbouring squares around it. Unlike castling, this move can be performed as many times throughout the game as you want. The following special rules apply:
     * It cannot move itself into check by doing so (surprise!).
     * It cannot move pawns to the player’s first rank (where pawns cannot be in ordinary chess either).
     * If it moves pawns to the player’s eighth rank, that pawn will be promoted as usual.
  3. Any pawn on the player’s second rank can move one or two pieces forward, even if it has previously moved forward and later been moved back by the king. (This is in order to simplify the game so that you don’t have to remember which of your pawns have moved forward previously.)
  
  The rules themselves do not really matter much. What I would like to know is how an AI engine would play against itself with this ruleset. Based on this, I hope to be able to make my own (human) assessment about how “deep” this variant is. I suppose it is possible to modify the rules given to engines like AlphaZero, MuZero, and Leela Chess Zero and ask the engine to teach itself the game as usual. But are there other, easier methods that do not require extensive rewritings of complicated engines?
  
  I am aware of questions like [this one](https://chess.stackexchange.com/questions/41325/how-can-i-get-a-chess-engine-to-play-custom-chess-variants) and its answer, but it doesn’t seem that the answer can be adapted to support this variant.
  
  **Tags:** engines, chess-variants, chess-ai
  
  > **Comments:**
  > **username_0**: @user30536 No, that wasn’t what I meant by the question. What I meant was that I would like to ask the engine to play the game against itself many times in order to study its playing style and how this affects the game tactically. And then, from looking at these games, I would make my own assessment about how “deep” this variant is, from a human perspective. (I updated the question to clarify this.)  
  > **username_1**: Most engines are optimized to play standard chess. Fairy Stockfish supports some variants. If you want to train the engine with self-learning like Leela Zero for custom rules, you need to implement those rules and see how to setup training yourself.  
  > **username_2**: What exactly do you mean by " how “deep” this variant is."? What is the name of the variant? Is this variant already played elsewhere? Looks like not difficult to implement. But another issue is the GUI. Or you can just play it manually. In a kp vs k ending, the kp will win even if the defending king is in front of the pawn because the king and pawn can just swap at appropriate moment.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2023-07-07. Score: 3
  
  Currently there is no “easy” way to do exactly this. The “easiest” way in this case would simply be the right way. You would have to learn a coding language and develop a chess computer using an existing neural network technology.
  
  There are plenty of tutorials online for how to make your own chess computer. You could follow those tutorials, and where it explains how to implement the rules of the game, you would simply implement your own rules in place of the regular chess rules. Once you are finished with creating the game, you would probably want to use NEAT to train an ai to play it. NEAT stands for Neuro Evolution of Augmenting Topologies.
  
  Before putting this massive amount of effort in, I suggest reading the following study: Assessing Game Balance with AlphaZero: Exploring Alternative Rule Sets in Chess.
  
  In this study, they forced the DeepMind project to play variants of chess that didn’t really exist. The most interesting variation was one where pawns could move, but not capture, sideways, in addition to their other moves.
  
  They found that changing the castling rules did not produce much interesting gameplay, though I will note that none of their rules gave the king infinite quasi castling power like you’re describing.
  
  Perhaps the easiest way to do this would be to use our imagination. I am a variants enthusiast and atomic player so I will give it my best shot.
  
  The King is the most important piece in the game and defending it is the most important goal, second only to capturing the opponent’s King. This tells me that the most likely application of your rule change would be to defend the king one move before potential checkmate. There would also be special endgame circumstances where once the majority of pieces were off the board, the king would then carry a pawn on its back to promotion. For example, the king could prevent a pawn from ever being on a dark square against a dark square bishop.
  
  In addition, moves that improve king position and the position of another piece could become strategy. The concept of moving two pieces at once could be seen as overpowered and preferred to the usual methods.
  
  Finally, the last effect from your rule change could be an increase in king walks. There are a handful of grandmaster games where one side for whatever reason has to get up and run, and after 10 or so king moves finally there is room to breathe to deliver a deadly attack. More movement options for the king would make these oddly long king walks more possible to accomplish.
  
  In terms of depth, it would be technically deeper than chess since it offers more move possibility. Which giant number to compare to shannons number I wouldn’t know how to calculate.
  
  If that doesn’t sound interesting to you, how about a variant where any piece can do a neighborly swap? Now that would create a game that looks alien to players.
  
  All in all the answer to this question is yours to decide, but hopefully this gives you some insight as to what goes into this sort of thing.
  
  Edit: OP pointed out that this rule change now allows bishops to swap colors. This opens up possibilities for bishops to defend eachother. As early as move 1 you could elect to have two same color bishops.
  
  > **Comments:**
  > **username_0**: Let me add what I think would be one of the most crucial applications of this rule: The ability to make a light-squared bishop into a dark-squared one or vice versa.  
  > **username_3**: Completely missed this. I think this would be an entertaining variant, and one that would be difficult to master.  
  > **username_4**: *Currently there is no “easy” way to do exactly this. The “easiest” way in this case would simply be the right way. You would have to learn a coding language and develop a chess computer using an existing neural network technology.* Is this correct? I have never done that, but I imagine modifying [Lczero's source code](https://github.com/LeelaChessZero/lc0) to change the core rules is much less work than starting development from zero. And you don't mention training time, which rates to be the most expensive part (in terms of time, computing resources, or both).  
  > **username_0**: @username_4 I thought about doing exactly that, but I have no idea how many computer resources it would require to reach an advanced level. How far could you get by letting it run in a cheap work laptop?  
  > **username_4**: @username_0 I have no idea either; I have no experience in that area unfortunately. Hopefully the training time could be reduced by starting from a network pre-trained for regular chess, since the two games are similar in the end. And I wouldn't use a cheap laptop but rather buy cloud computing resources. From what i can read on the internet about lczero's training, I would guess between 100-1000$ to get to superhuman level, but my estimate could be far off since I know very little about it.  
  
  ---
  
  