Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Repetition detection in TSCP

Author: David Hanley

Date: 12:40:18 01/16/02

Go up one level in this thread


Well, is doing a correct repitition detection *that* hard?

I keep two stacks.  One is hash codes, and one is reversable count.

When a move is played, i push the hash code after playing it to the hash code
stack.

If it's a pawn move or capture, i push 0 onto the reversable stack.  Otherwise i
push 1+ the top of the stack.

To see if we have a 3-fold repitition, i count how many times the current
position appears in the stack, and i can leave as soon as i see a 0 in the
reversable stack.  You can also bail out if the number of repitions is 3.

To see if there's a 50 move draw i peek to see if the top of the unreversable
stack equals 100.

Sounds complicated, i guess, but it's about 20 lines of code total, and it's
virtually as fast as a hashing scheme, i think, in practice, since reversable
moves are played pretty frequently, especially in the search tree.

dave



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.