You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of the Hash trait uses only the field 'hash' which is only affected by the pieces positions. On the other hand, the implementation of PartialEq compare all fields of the struct.
This causes unnecessary collisions in hashmap/hashset.
To solve it, the implementation of the Hash trait could simply use the get_hash() func.
The text was updated successfully, but these errors were encountered:
I do not believe this is true. The reason the hash trait is implemented the way it is is to incrementally update the hash function. This is a technique called Zobrist hashing.
If you can find an example of such a collision, I'd love to see it.
The implementation of the Hash trait uses only the field 'hash' which is only affected by the pieces positions. On the other hand, the implementation of PartialEq compare all fields of the struct.
This causes unnecessary collisions in hashmap/hashset.
To solve it, the implementation of the Hash trait could simply use the get_hash() func.
The text was updated successfully, but these errors were encountered: