Right now it loops through all the legal moves and checks if any of them end on the king's square for each board state, but I think it should be possible to look for checkmate every time a move is played by just looking if it the move ends on the king's square. That should be a lot faster.
Right now it loops through all the legal moves and checks if any of them end on the king's square for each board state, but I think it should be possible to look for checkmate every time a move is played by just looking if it the move ends on the king's square. That should be a lot faster.