wouldn't it be possible to have a move generator generating the move strings for all pseudo-legal moves in the Pre-Move code, and have it do a string compare for each of those with thismove , to see if one matches?
Presets have been programmed to generate a set of legal moves, and these get passed to JavaScript for the purpose of displaying legal moves. But these are stored as pairs of coordinates, not as longer strings with multiple moves. These sometimes miss crucial information about a move, such as a Pawn being able to capture by en passant, and they don't contain the complete move, such as what a Pawn promotes to on reaching the last rank.
Besides that, this gets done in the Post-Game sections, where it gets done only after checking whether all past moves are legal. What you're suggesting is to do it for every single move every single time it gets reprocessed, and to also do it in a more thorough manner than it normally gets done. This would be very costly, and it would get costlier with each move, possibly bogging down the script.
Presets have been programmed to generate a set of legal moves, and these get passed to JavaScript for the purpose of displaying legal moves. But these are stored as pairs of coordinates, not as longer strings with multiple moves. These sometimes miss crucial information about a move, such as a Pawn being able to capture by en passant, and they don't contain the complete move, such as what a Pawn promotes to on reaching the last rank.
Besides that, this gets done in the Post-Game sections, where it gets done only after checking whether all past moves are legal. What you're suggesting is to do it for every single move every single time it gets reprocessed, and to also do it in a more thorough manner than it normally gets done. This would be very costly, and it would get costlier with each move, possibly bogging down the script.