Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrgwbland opened this issue Sep 2, 2023 · 2 comments

Comments

@mrgwbland
Copy link

mrgwbland commented Sep 2, 2023

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);
}

@Edward-789
Copy link

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

@jongdetim
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants