TKPending / ChessGame

HTML and Javascript Chess Game
0 stars 0 forks source link

CG-18 Check if King is being attacked #30

Closed TKPending closed 9 months ago

TKPending commented 9 months ago

Did some code refactoring. Moved some files around, along with shorten the generate legal moves function.

Implemented the logic for checking whether the king is being attacked. Now whenever the king is in a position where it is being attacked, we will know.

Notes: We're currently judging the check based on pieces that have moved. But if the king moves in-front of a piece that hasn't moved, it won't be registered as checked. I also need to update how the function will be used, so it checks check based on who's turn it is rather than checking both at the same time.