- Here is the print result
```python
----------hash-function for (x=1 y=1 z=1)-----------
ten minutes physics: 1621
interactive-graphics: 547
----------hash-function for (x=1 y=1 z=-1)-----------
ten minutes physics: 1621
interactive-graphics: 965
So if the cell index is negative, it will get the same hash code as same as it is positive
Solution
I change another hash funciton which is created by interactive-graphics,who I believe are matthias's old friends
Things go right just as my python code shows above, and the result for my simulation now fixed:
At last
In the tutorial, the simulaiton is all above the ground plane, so the z nubmer is always positive
Is there anything I am not doing right ? I hope someone will help me find out or this solution is also helpful to you
Background
The problem
nTableSize = 2000 nX = 1 nY = 1 nZ = 1 h1 = abs((nX 92837111) ^ (nY 689287499) ^ (nZ 283923481)) % nTableSize h2 = (73856093 nX + 19349663 nY + 83492791 nZ) % nTableSize print("----------hash-function for (x=1 y=1 z=1)-----------") print("ten minutes physics:", h1) print("interactive-graphics:",h2) print("")
nX = 1 nY = 1 nZ = -1 h1 = abs((nX 92837111) ^ (nY 689287499) ^ (nZ 283923481)) % nTableSize h2 = (73856093 nX + 19349663 nY + 83492791 nZ) % nTableSize print("----------hash-function for (x=1 y=1 z=-1)-----------") print("ten minutes physics:", h1) print("interactive-graphics:",h2)
Solution
At last