
When black or white are in Check, if they make a move where they would still be in Check, the move is not undone. The main problem is that the code is buggy. Moves are called in my Square class (a simple mouse click function). In my ChessBoard class, I have testCheckWhite and testCheckBlack functions that are called after every move. If a move is made by White that causes Black's king to be on a square that is protectedByWhite, and vice versa with Black, Black's next move must place his king on a square that is not protectedByWhite. That is protectedByBlack, and vice versa with Black, the move is
If a move is made by White that causes his king to be on a square.There are two main pieces of logic with check: I went about implementing Check by assigning the Squares of my ChessBoard two booleans: protectedByWhite and protectedByBlack.
Basically I have a working Chess game with all of the rules of Chess except Check (and thus also not Checkmate, stalemate, etc.) implemented. This question is fairly large and difficult to solve without looking through my code, and if it's exceedingly so, then the scope is probably too large and I'll delete the question.