Very interesting! But I don&#x27;t quite see why you need to bother with tracking pieces and swapping them. Can&#x27;t you just go by the convention that pawn 0 is the first pawn you find when scanning across from a1 to h8, pawn 1 is the second pawn, etc.? Similarly for the knights, bishops, and rooks? (obviously still using the fallback when necessary)<p>That would eliminate the need for computing swaps while still producing the same move code for a given move in a given position.