viperscape/rust-chess

kings' check

Opened this issue · 3 comments

track kings' check before any move is validated
this will likely require brute force checking of each piece for a check before any move completes.
this also includes the king potentially moving in to check, or a piece incidentally placing king in check

this might require a state tracker for the completed move (piece from -> to, plus potential capture/upgrade) and to be unrolled when a check is revealed for that active player's king, thus invalidating the move.

idea: copy the game-table arrays, work off the dupe, if success reset main to dupe, else drop dupe

need to implement check-mate, check and board rollback is all completed