Repetiion rules and 50 moves without hash table

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Repetiion rules and 50 moves without hash table

Postby NaltaP312 » 23 Sep 2009, 05:23

Hello great team,

I continue to try to develop my engine and debug it ;)
and i have a little question resume in the subject.

Is it possible to not use has table to found 3 repeat position and 50 moves.
I have an idea to use fen and store all fen position for each move played, but it seems than the art of development is to use hashtable.

thanks for feedback.
Best Regards
NaltaP
User avatar
NaltaP312
 
Posts: 13
Joined: 02 Jun 2009, 19:24

Re: Repetiion rules and 50 moves without hash table

Postby Dann Corbit » 23 Sep 2009, 07:04

You can find 50 move with the half move clock alone, but hash is better.
You can find three position repeats by scanning the history if you store the whole FEN or EPD but hash is better.

There is always more than one way to solve a problem. But when you see everyone using hash, there's probably a reason for it.
Dann Corbit
 

Re: Repetiion rules and 50 moves without hash table

Postby Gerd Isenberg » 23 Sep 2009, 07:43

Maybe more common is an array of zobrist hashkeys, and to compare hashkey[currentply] with hashkey[currentply-4], hashkey[currentply-6]... as long as the half move clock indicates. In case of equality with one of the previous keys, a (at least) two-fold repetition is detected. One can distinguish cases where the found index is inside or outside the search tree. If the first occurrence applies inside the search tree, one usually returns draw score immediately. Otherwise one may continue to look for a threefold repetition.
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: Repetiion rules and 50 moves without hash table

Postby Dann Corbit » 23 Sep 2009, 08:04

Gerd Isenberg wrote:Maybe more common is an array of zobrist hashkeys, and to compare hashkey[currentply] with hashkey[currentply-4], hashkey[currentply-6]... as long as the half move clock indicates. In case of equality with one of the previous keys, a (at least) two-fold repetition is detected. One can distinguish cases where the found index is inside or outside the search tree. If the first occurrence applies inside the search tree, one usually returns draw score immediately. Otherwise one may continue to look for a threefold repetition.


But doesn't this method also use a hash (the Zobrist keys)?
Dann Corbit
 

Re: Repetiion rules and 50 moves without hash table

Postby Gerd Isenberg » 23 Sep 2009, 11:13

OK, with hashing I associated a dedicated small hashtable alá Gerbil or Rookie (http://alexandria.tue.nl/extra2/afstver ... ck2002.pdf page 39, Courtesy to Ronald de Man), where hashkeys (part of it) are used to index a small table to "lock" nodes.

So we both refer the game-record approach to compare zobrist-keys rather than fen-strings :)
Gerd Isenberg
 
Posts: 285
Joined: 31 Jan 2005, 20:31
Location: Hattingen, Germany

Re: Repetiion rules and 50 moves without hash table

Postby NaltaP312 » 23 Sep 2009, 18:51

Hello Dan and Gerd,

thanks for you reply.
I have understand my future work, may in one month : how to use hash table.
I will read this article and work with it.
http://chessprogramming.wikispaces.com/Repetitions

Thanks again.
Best Regards
NaltaP
User avatar
NaltaP312
 
Posts: 13
Joined: 02 Jun 2009, 19:24

Re: Repetiion rules and 50 moves without hash table

Postby H.G.Muller » 23 Sep 2009, 22:31

To be any good inthe end-game a prorgam will need a hash table anyway, and once the hash key is available, it is convenient to also use it for repetition detection. Even when you do't have a hash table yet, and want to do repetition detection, you could develop a Zobrist key just for that. (And easily upgrade to areal transposition table later...) Calculating Zobrist keys is not anymore difficult than calculating other compact unique representations of the position. In fact, because it can be updated differentially, it is much easier than most other forms of signature (like FENs or Hufmann coding). Only the board itself (if you use a mailbox board with piece types on it) is as easy to update as the Zobrist key, but it is very bulkey in comparison.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 11 guests