Now that we have all the chess pieces and chessboard-related validation rules in place, let's add life to our chess program. In this iteration, we will make our chess game fully functional.
The objective of this iteration is to move the chess pieces with a click of the left mouse button. When a player clicks on a chess piece, the code should first check whether it is a legitimate turn for that chess piece.
On the first click, the chess piece that needs to be moved is selected, and all the allowed moves for that chess piece are highlighted on the chessboard. The second click should be performed on the destination square. If the second click is done on a valid destination square, the chess piece should move from the source square to the destination square.
We also need to code the events of capturing chess pieces and the king being in check. The other...