🕸📝Fergus Duniho wrote on Sat, Mar 14, 2020 12:13 AM UTC:
There is already a simple solution available, which is to give the castling move to the Rook when the King moves one space. It's best to not allow players to enter reverse notation with mouse clicks, because it would rarely have any use, and it would more frequently just mess up regular moves. Also bear in mind that the JavaScript used to make moves is a simple client-side mechanism that cannot connect with the server-side code used for enforcing rules except by submitting a form. It does not have the rules programmed into it, and it has to operate on its own, its only data being a list of legal moves and a representation of the board.
There is already a simple solution available, which is to give the castling move to the Rook when the King moves one space. It's best to not allow players to enter reverse notation with mouse clicks, because it would rarely have any use, and it would more frequently just mess up regular moves. Also bear in mind that the JavaScript used to make moves is a simple client-side mechanism that cannot connect with the server-side code used for enforcing rules except by submitting a form. It does not have the rules programmed into it, and it has to operate on its own, its only data being a list of legal moves and a representation of the board.