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

Need a faster way to quickly check if there are legal moves in the position. #2

Open
master-spike opened this issue Sep 15, 2023 · 0 comments
Assignees
Labels
performance Something is working slower than it could, potentially

Comments

@master-spike
Copy link
Owner

In search, at terminal nodes, we have to test whether or not the side to move has legal moves before returning a static evaluation of the position. Currently, this is done by invoking generateMoves() and checking if the resultant move vector is empty. However, this is slow and since terminal nodes make up a substantial portion of the visited nodes in the search, we can improve performance if we had a much simpler "hasLegalMoves()" function.

Such a function would return early upon seeing a legal move, and in positions where the side to move is not in check, we don't have to check the magic bitboards for sliders, just a one tile adjacency. As full-on move generation is quite involved it is hoped that a change like this would improve performance by a decent margin.

@master-spike master-spike added the performance Something is working slower than it could, potentially label Sep 15, 2023
@master-spike master-spike self-assigned this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Something is working slower than it could, potentially
Projects
None yet
Development

No branches or pull requests

1 participant