Answers.Body: <p>Since no one has answered yet, I will try some simple analysis first.</p>
  <p>Let's first make sure all vanilla moves/move types are possible without considering ways for the game to end. In the data, all types but bishop/knight double disambiguation capture checkmate and bishop double disambiguation capture check (non-mate) already exist, and it's not hard to see all these types are possible in constructed games. But are all moves possible too? Excluding obvious incompatibilities, such as disambiguation in conflict with piece movement rules (like Ra1b2) or impossible pawn/en passant situations (such as dxe2 en passant) - although the data's notation doesn't show e.p. directly, and pawn disambiguation is impossible (for standard algebraic notation afaik).</p>
  <p>Now there are some combinations of disambiguation and target squares that are simply impossible. Rb2a1 is obviously illegal, but Bb2a1/Bba1/B1a1 are also geometrically impossible because no arrangement of other pieces can require such disambiguation.</p>
  <p>Even if a disambiguated move is itself possible, it may be incompatible with checks/checkmates. Any move that can't possibly cause new squares to become attacked cannot cause check or checkmate. This is relevant if disambiguation in the move happens to make the start square and end square badly aligned with other pieces of the same type that must have been on certain squares, especially for queens. For example, Qb2a1 cannot cause new attacks because other queens must have been on b1 and a2 as well, so Qb2a1+ and Qb2a1# are impossible; same for Qc3(a1/b2),Qd4(a1/b2), and maybe more that I haven't found systematically. Edit: I'm not sure about bishops, as eg. Bc3b2 doesn't make the bishops attack more squares but may discover check/mate.</p>
  <p>Is this too obvious to count? Maybe not and we can conclude that not all moves in chess (judging by naive combinations of algebraic notation) are possible, or we can say that these are not allowable algebraic notations of moves (just like double disambiguated rook moves are not allowed) but determining what are allowable algebraic notations of chess moves is not quite as trivial as one may think.</p>
  <p>Apart from these geometrically constrained queen/bishop double disambiguated check/checkmate moves, are there other better examples of moves impossible for less trivial reasons? Like ones requiring retroanalysis? I don't know yet.</p>
  <p>Going beyond vanilla notation to other ways to end the game, let's lump resignation, timeout and draw by agreement together because they can theoretically happen at any possible non-ending move, so they don't cause any impossibilities.</p>
  <p>That leaves draws by stalemate, insufficient material, 50-move, or repetition. Stalemate is incompatible with checks/checkmates, moves that cause insufficient material must be captures (or promotions!), 50-move and repetition are incompatible with captures/pawn moves/castling/promotion, but otherwise I don't see an obvious impossibility.</p>
  <p>I know this sounds tedious, but in case somehow no one else has done this before, why not do some &quot;notation coverage testing&quot; for chess? Edit: I later found this page<a href="https://www.chess.com/blog/kurtgodden/think-you-know-algebraic-notation" rel="nofollow noreferrer">Think You Know Algebraic Notation?</a> that lists numbers of possible algebraic move notations for each piece, but the author didn't show the full calculation so I have no idea which moves are actually ruled out and why.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T18:01:55.177Z
Answers.Text: My [SAN-strings](https://github.com/jacksonthall22/SAN-strings) repo might be of interest to you - but this answer made me realize I need to make some changes about which moves can deliver check/mate ([issue](https://github.com/jacksonthall22/SAN-strings/issues/4))
Answers.UserDisplayName: Jackson H
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T19:06:17.743Z
Answers.Text: @JacksonH Thanks! However there must be many more impossible situations that I missed. Also, is disambiguation of a check/mate move still standard/necessary if only while multiple pieces could move there, only one possible move can be check/checkmate? This changes the result a lot, but at least Lichess still disambiguates. And interestingly, all three of you have different numbers of possible moves: you list the number as 29274, the author of Think You Know Algebraic Notation? as 29742, and the author of the video seems to assume a much higher number. There should be a collaboration for this.
Answers.UserDisplayName: alices_and_bobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T19:29:18.843Z
Answers.Text: @alice_and_bobs I agree about the collaboration! Calculating the number of potential SAN moves is a surprisingly difficult problem that has interested me for a while. I think "modifiers" like `+`/`#` are generally considered optional (at least in most chess programs/software this seems to be the case), so I don't think the presence of one would make disambiguators unnecessary. Plus - I think that requirement would create so many edge cases that any solution would be way too difficult to prove correct!
Answers.UserDisplayName: Jackson H
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T19:31:54.310Z
Answers.Text: @JacksonH I considered narrowing the scope of the question to just possible vanilla notations without stalemate etc, but (it surprised me that) questions along those lines have been asked many times (including on SE) per Google, but tend to get different answers each time, from 20000s to 40000s. Is there really no definitive answer? And if not yet, can it be resolved with clever math, or is retroanalysis/experiment necessary? Maybe we need theoretical upper bound+experimental lower bound, but I imagine Lichess won't be too happy if people started trying to play all possible moves on it.
Answers.UserDisplayName: alices_and_bobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T19:35:31.737Z
Answers.Text: I would have to do some analysis, but I am almost certain there cannot be *more* than 29,274 moves - my guess is the author of that article missed some of the weird edge cases with bishops (see [here](https://github.com/jacksonthall22/SAN-strings/tree/f10d043489958b8978e413bd18218b02da43bb95?tab=readme-ov-file#bishops), from a commit right before I overhauled the script a few months ago)
Answers.UserDisplayName: Jackson H
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T19:46:29.600Z
Answers.Text: @alice_and_bobs The "vanilla" question is actually a very easy case if you use the right approach - I did a full write up in the readme. Initially I tried to do the same type of per-piece logic, and realized that it's just incredibly difficult. So I switched to an algorithm that is so generalized it basically "must be correct", but I've been wrong before...
Answers.UserDisplayName: Jackson H
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-11T15:07:37.860Z
Answers.Text: This is exactly the type of question where you should utilize the experience of problemists. (Shameless plug for MatPlusForum :-)
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-12T00:15:42.523Z
Answers.Text: @HaukeReddmann Thanks! Didn't know problemists would be interested(I don't know much about chess problems). Which part of the question would be appropriate:  how many move notations are possible, whether all (reasonable) combinations with all game endings are possible, or whether retroanalysis is needed to rule out any of them? And how should I ask?
Answers.UserDisplayName: alices_and_bobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-12T06:27:57.357Z
Answers.Text: @alices_and_bobs: E,g, Werner Keym did a lot of chess problems related to such questions and is a reknowned expert. Email can be googled (it was in the top google list), tell him I sent you :-) Otherwise, as I already said, this might lead to an interesting discussion on MatPlusForum (also easily found).
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-10T02:52:22.833Z
Answers.LastActivityDate: 2024-06-10T03:54:39.890Z
Answers.LastEditDate: 2024-06-10T03:54:39.890Z
Answers.UserDisplayName: alices_and_bobs
Body: <p>Inspired by this video <a href="https://youtu.be/iDnW0WiCqNc" rel="nofollow noreferrer">The rarest move in chess</a>, in which moves are categorized based on the format of their algebraic notation, so for example the rarest type of move (according to the author and Lichess data at the time of video upload) is &quot;Bishop double disambiguations capture mates&quot;, for example Bf4xd6#. (Note: someone in the comments section said they just played a game with that move so it may no longer be the rarest) Edit: the reason why types of notation rather than individual distinct notations were used is that about 30% of all possible move notations don't appear in the data. I think many of them are just too rare if not impossible.</p>
  <p>However as someone commented, stalemate was not considered in the notation's format, as there's no required symbol for stalemate in FIDE's handbook (see <a href="https://chess.stackexchange.com/questions/14569">Is there a proper way to indicate &quot;stalemate&quot; on your scoresheet?</a>), but then even the symbol for checkmate is also optional according to one answer. The same for other ways for the game game to end, such as fifty-move rule. So if combinations involving stalemate and other ways to legally end the game are also considered separate types, like types involving checkmates, are all types of moves still possible? And if so, are all individual moves possible too (sorry if there's an obvious impossible combination that I missed)? Clarification: as long as they are not obviously against the rules, such as combination of check and stalemate is obviously impossible.</p>
  
Tags: <theory><records><mathematics>
Title: Are all moves or types of moves (see details) in chess possible?
ThreadText: # Are all moves or types of moves (see details) in chess possible?
  
  (Asked by: username_0 on 2024-06-09)
  
  Inspired by this video [The rarest move in chess](https://youtu.be/iDnW0WiCqNc), in which moves are categorized based on the format of their algebraic notation, so for example the rarest type of move (according to the author and Lichess data at the time of video upload) is "Bishop double disambiguations capture mates", for example Bf4xd6#. (Note: someone in the comments section said they just played a game with that move so it may no longer be the rarest) Edit: the reason why types of notation rather than individual distinct notations were used is that about 30% of all possible move notations don't appear in the data. I think many of them are just too rare if not impossible.
  
  However as someone commented, stalemate was not considered in the notation's format, as there's no required symbol for stalemate in FIDE's handbook (see [Is there a proper way to indicate "stalemate" on your scoresheet?](https://chess.stackexchange.com/questions/14569)), but then even the symbol for checkmate is also optional according to one answer. The same for other ways for the game game to end, such as fifty-move rule. So if combinations involving stalemate and other ways to legally end the game are also considered separate types, like types involving checkmates, are all types of moves still possible? And if so, are all individual moves possible too (sorry if there's an obvious impossible combination that I missed)? Clarification: as long as they are not obviously against the rules, such as combination of check and stalemate is obviously impossible.
  
  **Tags:** theory, records, mathematics
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-06-10. Score: 1
  
  Since no one has answered yet, I will try some simple analysis first.
  
  Let's first make sure all vanilla moves/move types are possible without considering ways for the game to end. In the data, all types but bishop/knight double disambiguation capture checkmate and bishop double disambiguation capture check (non-mate) already exist, and it's not hard to see all these types are possible in constructed games. But are all moves possible too? Excluding obvious incompatibilities, such as disambiguation in conflict with piece movement rules (like Ra1b2) or impossible pawn/en passant situations (such as dxe2 en passant) - although the data's notation doesn't show e.p. directly, and pawn disambiguation is impossible (for standard algebraic notation afaik).
  
  Now there are some combinations of disambiguation and target squares that are simply impossible. Rb2a1 is obviously illegal, but Bb2a1/Bba1/B1a1 are also geometrically impossible because no arrangement of other pieces can require such disambiguation.
  
  Even if a disambiguated move is itself possible, it may be incompatible with checks/checkmates. Any move that can't possibly cause new squares to become attacked cannot cause check or checkmate. This is relevant if disambiguation in the move happens to make the start square and end square badly aligned with other pieces of the same type that must have been on certain squares, especially for queens. For example, Qb2a1 cannot cause new attacks because other queens must have been on b1 and a2 as well, so Qb2a1+ and Qb2a1# are impossible; same for Qc3(a1/b2),Qd4(a1/b2), and maybe more that I haven't found systematically. Edit: I'm not sure about bishops, as eg. Bc3b2 doesn't make the bishops attack more squares but may discover check/mate.
  
  Is this too obvious to count? Maybe not and we can conclude that not all moves in chess (judging by naive combinations of algebraic notation) are possible, or we can say that these are not allowable algebraic notations of moves (just like double disambiguated rook moves are not allowed) but determining what are allowable algebraic notations of chess moves is not quite as trivial as one may think.
  
  Apart from these geometrically constrained queen/bishop double disambiguated check/checkmate moves, are there other better examples of moves impossible for less trivial reasons? Like ones requiring retroanalysis? I don't know yet.
  
  Going beyond vanilla notation to other ways to end the game, let's lump resignation, timeout and draw by agreement together because they can theoretically happen at any possible non-ending move, so they don't cause any impossibilities.
  
  That leaves draws by stalemate, insufficient material, 50-move, or repetition. Stalemate is incompatible with checks/checkmates, moves that cause insufficient material must be captures (or promotions!), 50-move and repetition are incompatible with captures/pawn moves/castling/promotion, but otherwise I don't see an obvious impossibility.
  
  I know this sounds tedious, but in case somehow no one else has done this before, why not do some "notation coverage testing" for chess? Edit: I later found this page[Think You Know Algebraic Notation?](https://www.chess.com/blog/kurtgodden/think-you-know-algebraic-notation) that lists numbers of possible algebraic move notations for each piece, but the author didn't show the full calculation so I have no idea which moves are actually ruled out and why.
  
  > **Comments:**
  > **username_1**: My [SAN-strings](https://github.com/jacksonthall22/SAN-strings) repo might be of interest to you - but this answer made me realize I need to make some changes about which moves can deliver check/mate ([issue](https://github.com/jacksonthall22/SAN-strings/issues/4))  
  > **username_0**: @JacksonH Thanks! However there must be many more impossible situations that I missed. Also, is disambiguation of a check/mate move still standard/necessary if only while multiple pieces could move there, only one possible move can be check/checkmate? This changes the result a lot, but at least Lichess still disambiguates. And interestingly, all three of you have different numbers of possible moves: you list the number as 29274, the author of Think You Know Algebraic Notation? as 29742, and the author of the video seems to assume a much higher number. There should be a collaboration for this.  
  > **username_1**: @alice_and_bobs I agree about the collaboration! Calculating the number of potential SAN moves is a surprisingly difficult problem that has interested me for a while. I think "modifiers" like `+`/`#` are generally considered optional (at least in most chess programs/software this seems to be the case), so I don't think the presence of one would make disambiguators unnecessary. Plus - I think that requirement would create so many edge cases that any solution would be way too difficult to prove correct!  
  > **username_0**: @JacksonH I considered narrowing the scope of the question to just possible vanilla notations without stalemate etc, but (it surprised me that) questions along those lines have been asked many times (including on SE) per Google, but tend to get different answers each time, from 20000s to 40000s. Is there really no definitive answer? And if not yet, can it be resolved with clever math, or is retroanalysis/experiment necessary? Maybe we need theoretical upper bound+experimental lower bound, but I imagine Lichess won't be too happy if people started trying to play all possible moves on it.  
  > **username_1**: I would have to do some analysis, but I am almost certain there cannot be *more* than 29,274 moves - my guess is the author of that article missed some of the weird edge cases with bishops (see [here](https://github.com/jacksonthall22/SAN-strings/tree/f10d043489958b8978e413bd18218b02da43bb95?tab=readme-ov-file#bishops), from a commit right before I overhauled the script a few months ago)  
  > **username_1**: @alice_and_bobs The "vanilla" question is actually a very easy case if you use the right approach - I did a full write up in the readme. Initially I tried to do the same type of per-piece logic, and realized that it's just incredibly difficult. So I switched to an algorithm that is so generalized it basically "must be correct", but I've been wrong before...  
  > **username_2**: This is exactly the type of question where you should utilize the experience of problemists. (Shameless plug for MatPlusForum :-)  
  > **username_0**: @HaukeReddmann Thanks! Didn't know problemists would be interested(I don't know much about chess problems). Which part of the question would be appropriate:  how many move notations are possible, whether all (reasonable) combinations with all game endings are possible, or whether retroanalysis is needed to rule out any of them? And how should I ask?  
  > **username_2**: @username_0: E,g, Werner Keym did a lot of chess problems related to such questions and is a reknowned expert. Email can be googled (it was in the top google list), tell him I sent you :-) Otherwise, as I already said, this might lead to an interesting discussion on MatPlusForum (also easily found).  
  
  ---
  
  