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

[Question] How does the opening tree/explorer work? #153

Closed
Pesky01 opened this issue Nov 24, 2023 · 1 comment
Closed

[Question] How does the opening tree/explorer work? #153

Pesky01 opened this issue Nov 24, 2023 · 1 comment

Comments

@Pesky01
Copy link

Pesky01 commented Nov 24, 2023

Tried reading the code but couldn't put it together.

How does scid retrieve all games on my board so fast (~1s) for a 5 million game DB? I thought this would be too compute inefficient but do you iterate over every position of every game but use shortcuts (i.e incompatible irreversible moves/home pawn data) to break early from checking the rest of the game? I thought final material would also be used for shortcut, but since pawns can promote you can't know if that's a early stop?

I also thought it was just a large hash table on-disk, but for that many unique positions it would be very memory inefficient.

@benini
Copy link
Owner

benini commented Nov 26, 2023

The database Index is fully loaded into memory and includes three Bloom filters:
https://github.com/benini/scid/blob/github/src/searchpos.h#L100
StoredLine uses the first moves of the game.
HomePawn take advantage of the fact that pawns can never go back to the intitial rank.
FinalMatSig uses the final material.
By using these filters, the number of games that need to be read from the disk and searched is greatly reduced.

@benini benini closed this as completed Nov 26, 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

2 participants