Drempel3387 / chessGame

1 stars 0 forks source link

Any time the king is in check, all legal moves are removed from the King's list of moves. #1

Closed Drempel3387 closed 1 year ago

Drempel3387 commented 1 year ago

https://github.com/Drempel3387/chessGame/blob/76d0a158dda1276e2edbb8f000d0f95ed94b8806/src/chess/engine/Pieces/King.java#L35

Drempel3387 commented 1 year ago

The kings starting position was kept track of and then it was modified to match the ending position for each move in the legal moves list. Only then, the check was done to see if the king was in check, this way, we can properly discard of any illegal king moves.