Chess-Challenge icon indicating copy to clipboard operation
Chess-Challenge copied to clipboard

There should be a quick way to check for only legal moves with checks and captures.

Open mrgwbland opened this issue 2 years ago • 2 comments

You can get just the legal moves which are captures so why not for checks as well? It would be a lot better than having to do the following code: Move[] legalMoves = board.GetLegalMoves(); foreach (Move move in legalMoves) { board.MakeMove(move); if (move.IsCapture||board.IsInCheck()) { code } else board.UndoMove(move); }

mrgwbland avatar Sep 02 '23 01:09 mrgwbland

The API cannot check if the board is in check without actually playing the move and then checking if the board is in check.

Edward-789 avatar Sep 02 '23 20:09 Edward-789

Edward is correct, and it's probably not getting changed, so you'll have to just spend the tokens if you want a list of checking moves

jongdetim avatar Sep 03 '23 17:09 jongdetim