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

zobrist hashing #45

Merged
merged 5 commits into from
Aug 31, 2021
Merged

zobrist hashing #45

merged 5 commits into from
Aug 31, 2021

Conversation

niklasf
Copy link
Owner

@niklasf niklasf commented Jun 18, 2021

for #40

@niklasf
Copy link
Owner Author

niklasf commented Jun 19, 2021

@wspeirs Thanks, this looks good so far. There are a few issues with chess variants. I believe it does not handle explosions in Atomic (a bug), and does not consider remaining checks in ThreeCheck (avoidable collisions).

Maybe you can make the variants implement a supporting trait ZobristHashable? That would allow skipping those variants and third-party variants.

@wspeirs
Copy link
Contributor

wspeirs commented Jun 20, 2021

@niklasf I did not take into account any of the variants. Looking at the code around play_unchecked for Atomic, it wouldn't be hard to encode the logic (removing the piece hashes when "exploding"); however, I'm unsure how to work this in via the feature gate mechanism in Rust. I think I need specialization, unless there's some "magic" we can perform with the feature-gate code. Any ideas on how to implement would be great!

Assuming we figure out the specialization/feature-gate stuff for Atomic, then it would be a bit more work to get ThreeCheck working. I'd need to add 6 more values to build.rs that represent how many checks are left for each side. Not terribly difficult, but slightly more work than Atomic.

kraktus added a commit to kraktus/shakmaty that referenced this pull request Aug 31, 2021
To select which variants can use the `Zobrist` trait, solve issues raised in niklasf#45.

Exposed so third-party variants can implement it.

* `Atomic` cannot use it because `play_unchecked` does not handle explosions.
* `CrazyHouse` is not properly supported because it does not account for the `Pocket` of the player.
* `TreeCheck` is not properly supported because it does not account for the `Check` in the position.
kraktus added a commit to kraktus/shakmaty that referenced this pull request Aug 31, 2021
To select which variants can use the `Zobrist` trait, solve issues raised in niklasf#45.

Exposed so third-party variants can implement it.

* `Atomic` cannot use it because `play_unchecked` does not handle explosions.
* `CrazyHouse` is not properly supported because it does not account for the `Pocket` of the player.
* `TreeCheck` is not properly supported because it does not account for the `Check` in the position.
@kraktus kraktus mentioned this pull request Aug 31, 2021
@niklasf niklasf merged commit 64520ae into niklasf:master Aug 31, 2021
@niklasf
Copy link
Owner Author

niklasf commented Aug 31, 2021

Continued in #46.

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

Successfully merging this pull request may close these issues.

2 participants