🕸📝Fergus Duniho wrote on Mon, Dec 14, 2020 02:07 AM UTC:
I have been working on code for analyzing the moves in a game of Fischer Random Chess to calculate what the original position was. It's mostly working fine, but there is one problem that is proving difficult. When a player castles by moving a King two or more spaces, and it doesn't yet know it is a King, it doesn't know this is a castling move, and it doesn't complete the castle. Later on, the Rook may try to move from a space it was never moved to. This error can cause a cascade of errors that screws up the calculation.
What I do know is that if a piece tries to move from an empty space, it must be a Rook, and a castle has previously happened. I might then reanalyze the previous moves for a castling move that would have put the Rook on that space. Since castling is not allowed when there is a piece between the King and the Rook, the Rook would have to be the first piece in the direction that the King moved.
I suppose it is also possible to do some further analysis on a move that is potentially a castling move made by a King. If I knew that the piece was a King, or something about the position indicated that it could not be a Rook or Queen, then I would know it is a castling move right away.
I have been working on code for analyzing the moves in a game of Fischer Random Chess to calculate what the original position was. It's mostly working fine, but there is one problem that is proving difficult. When a player castles by moving a King two or more spaces, and it doesn't yet know it is a King, it doesn't know this is a castling move, and it doesn't complete the castle. Later on, the Rook may try to move from a space it was never moved to. This error can cause a cascade of errors that screws up the calculation.
What I do know is that if a piece tries to move from an empty space, it must be a Rook, and a castle has previously happened. I might then reanalyze the previous moves for a castling move that would have put the Rook on that space. Since castling is not allowed when there is a piece between the King and the Rook, the Rook would have to be the first piece in the direction that the King moved.
I suppose it is also possible to do some further analysis on a move that is potentially a castling move made by a King. If I knew that the piece was a King, or something about the position indicated that it could not be a Rook or Queen, then I would know it is a castling move right away.