Creating a key for Transposition Table in Chess
I am having trouble understanding how to generate zobrist keys.
My chess board is represented by a 8x8 array of integers. How can I generate a key from this?
Many thanks to those who can help me outta this one, as it has been bugging me for quite some time.
http://www.seanet.com/~brucemo/topics/zobrist.htm
That has your answer.
That has your answer.
Sounds great! The next question I have is what is a good way to implement a tranposition table? I was thinking about using a hash map, but STL apparently doesn't have one. What would you guys recommend?
An array, of a size of the largest possible amount of ram you can get.
For eg. Assume the computer has 1Gb of ram, and it is currently using 120MB of it.
You start at 880Mb, and work your way down.
Once you have your big, (prime) table, you find your key for your map, and you % it with your size of your table, to find the position its in.
Be sure to only use what bits you need. (having a big transposition table helps a lot).
If there is already something there, you just check the number of nodes need to be searched in order to find it vs. the one you have. The one with the most nodes 'wins' (gets stored)
From,
Nice coder
For eg. Assume the computer has 1Gb of ram, and it is currently using 120MB of it.
You start at 880Mb, and work your way down.
For x = (880000000-1) to 2 step -2if isprime(x) then //use number exit subend ifnext x
Once you have your big, (prime) table, you find your key for your map, and you % it with your size of your table, to find the position its in.
Be sure to only use what bits you need. (having a big transposition table helps a lot).
If there is already something there, you just check the number of nodes need to be searched in order to find it vs. the one you have. The one with the most nodes 'wins' (gets stored)
From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Uh... well I guess that would work. My only question is, doesn't C++ stop you from having huge 100MB+ array memory slots? Also, what is the chance I am going to find that much memory all nicely spaced together? Finally, if you did keep your array that big, wouldn't it slow down the program, since you would essentially be keeping a lot of it in virtual memory?
I think I might go with a map for now. Once i get the program working, I will try and use a hash table.
I think I might go with a map for now. Once i get the program working, I will try and use a hash table.
Quote: Original post by Sagar_Indurkhya
Uh... well I guess that would work. My only question is, doesn't C++ stop you from having huge 100MB+ array memory slots? Also, what is the chance I am going to find that much memory all nicely spaced together? Finally, if you did keep your array that big, wouldn't it slow down the program, since you would essentially be keeping a lot of it in virtual memory?
I think I might go with a map for now. Once i get the program working, I will try and use a hash table.
No, if you make sure that your not allocating into virtual memory, then your fine (and fast too).
From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement