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

Significant performance boost to IsDraw method #474

Open
Sparxel opened this issue Sep 7, 2023 · 3 comments
Open

Significant performance boost to IsDraw method #474

Sparxel opened this issue Sep 7, 2023 · 3 comments

Comments

@Sparxel
Copy link

Sparxel commented Sep 7, 2023

The IsDraw() method in the Board.cs is currently
public bool IsDraw() { return IsFiftyMoveDraw() || IsInsufficientMaterial() || IsInStalemate() || IsRepeatedPosition(); }
I messed with the API code and moved the IsStalemate() part to the end, which actually gave ~7% boost to my nodes/second for my implementation. I suspect this is because the code for the IsStalemate and hence move generation is not evaluated at all if IsRepeatedPosition() returns true.
So can this tiny change be made to the API?

@Vanny-Chuck
Copy link

Issue a pull request!

@Vanny-Chuck
Copy link

@SebLague

@mcthouacbb
Copy link

You can just use isrepeateddraw and isfiftymovedraw alone, and detect stalemate and checkmate manually by detecting when there are 0 legal moves. insufficient material is just a waste of tokens as it does not provide any significant boost in playing strength

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