![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Tags: help |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi!
I wrote a simple Checkers program (I know it's not chess, but I believe you can help me anyway) and I wish to improve it. I've found a webpage(http://www.seanet.com/~brucemo/topics/hashing.htm) about transposition table, but I don't understand few things, especially this: 'The hash array is indexed via a ZobristKey. You take the key for the position, modulo it by the number of elements in your table, and that's the hash element that corresponds to this position.' - why is it modulo by the number of elements in table? Is it correct? I'm writing in Delphi, and I managed to rewrite the code from this page in Pascal, but I think it doesn't work well. Thanks in advance, Jarek |
| Ads |
|
#2
|
|||
|
|||
|
"(I know it's not chess, but I believe you
can help me anyway)" Restructure your beliefs. PJ -- "I think that gay marriage is something that should be between a man and a woman." - Arnold Schwarzenegger "Nothing can confound A wise man more than laughter from a dunce." - Lord Byron "There is no subject so old that something new cannot be said about it." - Fyodor Mikhailovich Dostoyevsky "Jarek" wrote in message ... Hi! I wrote a simple Checkers program (I know it's not chess, but I believe you can help me anyway) and I wish to improve it. I've found a webpage(http://www.seanet.com/~brucemo/topics/hashing.htm) about transposition table, but I don't understand few things, especially this: 'The hash array is indexed via a ZobristKey. You take the key for the position, modulo it by the number of elements in your table, and that's the hash element that corresponds to this position.' - why is it modulo by the number of elements in table? Is it correct? I'm writing in Delphi, and I managed to rewrite the code from this page in Pascal, but I think it doesn't work well. Thanks in advance, Jarek |
|
#3
|
|||
|
|||
|
"Jarek" schrieb im Newsbeitrag ... Hi! I wrote a simple Checkers program (I know it's not chess, but I believe you can help me anyway) and I wish to improve it. I've found a webpage(http://www.seanet.com/~brucemo/topics/hashing.htm) about transposition table, but I don't understand few things, especially this: 'The hash array is indexed via a ZobristKey. You take the key for the position, modulo it by the number of elements in your table, and that's the hash element that corresponds to this position.' - why is it modulo by the number of elements in table? Is it correct? I'm writing in Delphi, and I managed to rewrite the code from this page in Pascal, but I think it doesn't work well. Thanks in advance, Jarek Because when writing a value to or getting a value from the table, your index has to be within the range (I.E. the table size). As hashing works with having a hash key and that key is usually much bigger than the table size (both measured in bits), so somehow you have to get an index from the key. Modulo is a simple solution for that. But as with the above _many_ different keys will be mapped to the same index, you must assure that the received entry is really for your original key by comparing the key stored there with your original one. Maybe this could be a source of error in your case. BTW, concerning simple uses of TT, I see _no_ big difference between chess and checkers. -delphi- |
| Thread Tools | |
| Display Modes | |
|
|