Author: Vladimir Medvedev
Date: 04:19:12 10/17/02
Go up one level in this thread
I use the following method in my program: 1. Hashkey (__int64 number) is part of position structure, it is recalculated after each move. 2. I do not store history of hashkeys in some hash_history[MAX_GAME_LENGTH] array and check all 0...current_ply entries in this array to detect repetition. Instead, I have two arrays, int SearchRepetitions[REP_SIZE] and int HistoryRepetitions[REP_SIZE], where REP_SIZE = 100000...500000 (maybe, less values are possible too). After each MakeMove I increment corresponding elements in these arrays: SearchRepetitions[ pos.Hash % REP_HASH_SIZE ]++; or HistoryRepetitions[ pos.Hash % REP_HASH_SIZE ]++; 3. And don't forget to decrement: SearchRepetitions[ pos.Hash % REP_HASH_SIZE ]--; after UnmakeMove(). 4. Then simply check whether SearchRepetitions != 2 or HistoryRepetitions !=3. Of course, this method is theoretically incorrect, and hash collisions can result in false draw-by-repetition detection. But the probability is very small, I think - much less than probability of Windows crashing while series of games :)
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.