mikepound / opencubes

A community improved version of the polycubes project!
MIT License
44 stars 23 forks source link

My rotationally invariant hashcode solution. Hash Collision Rate of 0.234% at N = 13. #53

Open BenjaminFausett opened 8 months ago

BenjaminFausett commented 8 months ago

As the title says, I have created a hashcode which I think is pretty good. Its not only rotationally invariant but also reflectionally invariant too, so the same polycube given in any rotation/reflection always gets the same hashcode. The dream when I set out was to make a perfect hashcode with no collision, but I just couldn't find enough rotationally invariant distinguishing data to tell all polycubes apart.

The hashcode works by calculating each cubes manhattan distance (gird moves) and euclidean distance (straight line) to every other cube, and combining them all together to make a single hash. Thats still an N squared operation, but if it avoids having to do the 24 rotations its still faster for all N's less than 24. This solution was able to achieve N = 13 in 9 minutes on my machine.

https://github.com/BenjaminFausett/PolycubeEnumerator