Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: transposition tables: recognising repetitive positions

Author: José Carlos

Date: 02:41:31 08/09/01

Go up one level in this thread


On August 09, 2001 at 00:28:54, Scott Smedley wrote:

>Hi All,
>
>I've just implemented a transposition table in my chess program
>(affectionately known as DaRK KNiGHT) & the first thing I realised
>is that I have no way of detecting perpetual check, repetitive
>position draws & the like.
>
>So my question is:
>
>How can a program recognise/handle the 3rd occurance of a position if
>it's using a transposition table?
>
>The score for a position in the transposition table may or may not
>be based on draw-by-repetition terminal nodes in its search path.
>Actually, now that I think about it a litte more, this begs a more
>quintessential question:
>
>How do I avoid using an inaccurate score in a transposition table
>due to potential draw-by-repetition terminal nodes in the search path?
>
>SCoTT! :)

  I don't use the TT to detect repetitions. Instead, I check in the move list,
looking for the hash key of the actual position on the board.
  And I don't store draw-by-repetition scores in the TT, because they are messy
to handle. To detect the repetition, do this:
  At the top of your search function, compute the hash key for the actual
position (in case you don't do that incremental). Then, look at the list of
visited positions so far (tipically, a stack, where the top is the actual
position, and you add when make-move and remove when unmake-move), back until
the last capture/pawn move/castle. If you find the actual hash key (with the
same side to move), then you have a repetition.

  Hope this helps,

  José C.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.