I am wanting to write a chess engine (see here: 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

  • 2
    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"?
    – Remellion
    Commented Oct 8, 2019 at 4:18
  • 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. Commented Oct 8, 2019 at 4:21
  • 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?
    – Remellion
    Commented Oct 8, 2019 at 4:24
  • 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. Commented Oct 8, 2019 at 4:25
  • 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. Commented Oct 8, 2019 at 7:19

2 Answers 2


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.

  • 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. Commented Oct 8, 2019 at 4:22
  • Ah, I see that now. PGN always uses the = syntax, and that's what I'm used to seeing.
    – Chromatix
    Commented Oct 8, 2019 at 4:27
  • 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. Commented Oct 8, 2019 at 4:51

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.

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.