Answers.Body: <p>I immediately notice that you've missed the castling moves (O-O and O-O-O).</p>
  
  <p>I would list the pawn-promoting moves according to their PGN syntax (=Q/R/N/B suffix), as that's the most commonly used in computer chess.</p>
  
  <p>Algebraic notation can be ambiguous for sliding and leaping pieces (everything except pawn and king, actually) which may require specifying the origin rank, file, or both.  The latter is only needed for queens, bishops and knights, as rooks are always disambiguated by one or the other.</p>
  
  <p>It might be useful to treat the suffix codes indicating whether the move results in check or checkmate as orthogonal to the move itself, since pretty much any move can theoretically have those results.  This would effectively divide the number of unique moves you need to handle by three.  Conversely, the different promotions of a pawn definitely should be considered as unique moves.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-08T04:22:59.013Z
Answers.Text: Duh, castling is obvious, not sure how I missed that. But I handled promotion via `a8N` or `g1Q` (similarly, `a8N+` or `g1Q#`). Are these incorrect? I've seen promotion written a number of ways (`a8=N`) but believe there is no consensus for what is necessarily right.
Answers.UserDisplayName: David Chopin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-08T04:27:19.107Z
Answers.Text: Ah, I see that now.  PGN always uses the = syntax, and that's what I'm used to seeing.
Answers.UserDisplayName: Chromatix
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-08T04:51:40.860Z
Answers.Text: I'm gonna go ahead and add the = syntax, as well as castling obviously. Another note was ambiguous moves (like Red8 or R1e4 or Nfd5) pointed out by Remellion.
Answers.UserDisplayName: David Chopin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-08T04:20:05.543Z
Answers.LastActivityDate: 2019-10-08T04:32:13.363Z
Answers.LastEditDate: 2019-10-08T04:32:13.363Z
Answers.UserDisplayName: Chromatix
Answers.Body: <p>You've got a big list, but you forgot disambiguate moves.  N1f3, N1f3+, N1f3#, Qd6d4...</p>
  
  <p>If you want to include all possible Algebraic moves, you need to increase your list at least tenfold.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-19T12:05:59.013Z
Answers.LastActivityDate: 2019-10-19T12:05:59.013Z
Answers.UserDisplayName: Mike Jones
Body: <p>I am wanting to write a chess engine (see here: <a href="https://chess.stackexchange.com/questions/26489/creating-chess-engine-machine-learning-vs-traditional-engine">Creating chess engine, machine learning vs. traditional engine?</a>). The first step I am doing is taking a position in as an FEN and converting this position into an ideal move. Pseudocode would look something like this:</p>
  
  <p><code>Position → Move</code></p>
  
  <p>or using notation:</p>
  
  <p><code>rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 → e4</code></p>
  
  <p>I am trying to create an enumeration of every possible chess move, and I feel that I may be missing some. This includes moves like "e4", "Nxf5", "Bg3+", "Qxh4#", "exf8N#". My total count of unique moves that can be expressed using algebraic notation is <strong>1884</strong>. Can anybody confirm the total number of unique moves that can be expressed using algebraic notation? My full list of moves can be found here: <a href="https://pastebin.com/xDNqbFt2" rel="nofollow noreferrer">https://pastebin.com/xDNqbFt2</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-08T04:18:53.950Z
Comments.Text: Some clarification is needed. Are moves like Ne4, Ne4+, Ne4#, Nce4, Nce4+, N6e4, Nc6e4+ etc. all the same? What are your criteria for "unique moves"?
Comments.UserDisplayName: Remellion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-08T04:21:19.390Z
Comments.Text: I am just interested in finding the total number of possible valid algebraic notations in chess. For example, cxd6 can occur as the c5 pawn taking a d6 pawn. Similarly, the c5 pawn can take the pawn on d5 en passant. Two different moves, but they would both be expressed via `cxd6` I believe.
Comments.UserDisplayName: David Chopin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-08T04:24:13.827Z
Comments.Text: So you don't count disambiguations (e.g. you have to write Nbd2/Nfd2 instead of Nd2 if there are knights on f3 and b1) as different moves, and you don't count + and # as changing a move?
Comments.UserDisplayName: Remellion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-08T04:25:29.037Z
Comments.Text: Ah good call, hadn't considered things like knights or rooks sharing potential target squares, as well as queens and, conceivably, bishops received via underpromotion. I do consider + and # as individual moves. I.e. a8Q, a8Q+, and a8Q# are all uniquely considered in my file.
Comments.UserDisplayName: David Chopin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-08T07:19:04.887Z
Comments.Text: Why not just use some other notation internally, like fromsquare-tosquare (e4d5 for any piece moving from there to there)? You already know the position so keeping track of what kind of piece it was, whether it was check etc is just unnecessary complication for humans. Only extra needed is the choice of promotion piece.
Comments.UserDisplayName: RemcoGerlich
Tags: <programming><notation>
Title: How many moves can be expressed with algebraic chess notation?
ThreadText: # How many moves can be expressed with algebraic chess notation?
  
  (Asked by: username_0 on 2019-10-08)
  
  I am wanting to write a chess engine (see here: [Creating chess engine, machine learning vs. traditional engine?](https://chess.stackexchange.com/questions/26489/creating-chess-engine-machine-learning-vs-traditional-engine)). The first step I am doing is taking a position in as an FEN and converting this position into an ideal move. Pseudocode would look something like this:
  
  `Position → Move`
  
  or using notation:
  
  `rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 → e4`
  
  I am trying to create an enumeration of every possible chess move, and I feel that I may be missing some. This includes moves like "e4", "Nxf5", "Bg3+", "Qxh4#", "exf8N#". My total count of unique moves that can be expressed using algebraic notation is **1884**. Can anybody confirm the total number of unique moves that can be expressed using algebraic notation? My full list of moves can be found here: <https://pastebin.com/xDNqbFt2>
  
  **Tags:** programming, notation
  
  > **Comments:**
  > **username_1**: Some clarification is needed. Are moves like Ne4, Ne4+, Ne4#, Nce4, Nce4+, N6e4, Nc6e4+ etc. all the same? What are your criteria for "unique moves"?  
  > **username_0**: I am just interested in finding the total number of possible valid algebraic notations in chess. For example, cxd6 can occur as the c5 pawn taking a d6 pawn. Similarly, the c5 pawn can take the pawn on d5 en passant. Two different moves, but they would both be expressed via `cxd6` I believe.  
  > **username_1**: So you don't count disambiguations (e.g. you have to write Nbd2/Nfd2 instead of Nd2 if there are knights on f3 and b1) as different moves, and you don't count + and # as changing a move?  
  > **username_0**: Ah good call, hadn't considered things like knights or rooks sharing potential target squares, as well as queens and, conceivably, bishops received via underpromotion. I do consider + and # as individual moves. I.e. a8Q, a8Q+, and a8Q# are all uniquely considered in my file.  
  > **username_2**: Why not just use some other notation internally, like fromsquare-tosquare (e4d5 for any piece moving from there to there)? You already know the position so keeping track of what kind of piece it was, whether it was check etc is just unnecessary complication for humans. Only extra needed is the choice of promotion piece.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2019-10-08. Score: 2 | Accepted answer
  
  I immediately notice that you've missed the castling moves (O-O and O-O-O).
  
  I would list the pawn-promoting moves according to their PGN syntax (=Q/R/N/B suffix), as that's the most commonly used in computer chess.
  
  Algebraic notation can be ambiguous for sliding and leaping pieces (everything except pawn and king, actually) which may require specifying the origin rank, file, or both. The latter is only needed for queens, bishops and knights, as rooks are always disambiguated by one or the other.
  
  It might be useful to treat the suffix codes indicating whether the move results in check or checkmate as orthogonal to the move itself, since pretty much any move can theoretically have those results. This would effectively divide the number of unique moves you need to handle by three. Conversely, the different promotions of a pawn definitely should be considered as unique moves.
  
  > **Comments:**
  > **username_0**: Duh, castling is obvious, not sure how I missed that. But I handled promotion via `a8N` or `g1Q` (similarly, `a8N+` or `g1Q#`). Are these incorrect? I've seen promotion written a number of ways (`a8=N`) but believe there is no consensus for what is necessarily right.  
  > **username_3**: Ah, I see that now.  PGN always uses the = syntax, and that's what I'm used to seeing.  
  > **username_0**: I'm gonna go ahead and add the = syntax, as well as castling obviously. Another note was ambiguous moves (like Red8 or R1e4 or Nfd5) pointed out by username_1.  
  
  ---
  
  ### Answer by username_4 on 2019-10-19. Score: 0
  
  You've got a big list, but you forgot disambiguate moves. N1f3, N1f3+, N1f3#, Qd6d4...
  
  If you want to include all possible Algebraic moves, you need to increase your list at least tenfold.
  
  
  ---
  
  