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

Can I get GetLegalMoves of single piece? #18

Closed
MACAYCZ opened this issue Jul 21, 2023 · 3 comments
Closed

Can I get GetLegalMoves of single piece? #18

MACAYCZ opened this issue Jul 21, 2023 · 3 comments

Comments

@MACAYCZ
Copy link

MACAYCZ commented Jul 21, 2023

No description provided.

@WilliamAlecBrannon
Copy link

If you take a look at the documentation, and also the evilbot.cs example code, it seems like the easiest way to achieve that result would be to filter the legalmoves array in evilbot to all moves that have the same Move.StartSquare (since all moves from the same square on a position would be the same piece)

@AggregateException
Copy link

Presumably you'd want something like this:

Piece piece = board.GetPiece(board.GetLegalMoves()[0].StartSquare);
Move[] pieceMoves = board.GetLegalMoves().Where((x) => x.StartSquare == piece.Square).ToArray();

@MACAYCZ
Copy link
Author

MACAYCZ commented Jul 21, 2023

Ok, thank you guys!

@MACAYCZ MACAYCZ closed this as completed Jul 21, 2023
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