Author: Greg Lazarou
Date: 19:01:52 02/05/99
Go up one level in this thread
On February 05, 1999 at 21:11:23, James Robertson wrote: >My program is losing too many half-points by 3rd repetition draws. How do other >programs detect these draws? > >Thanks! >James Well, I have a very basic little chess program (started by reading TSCP a month or so ago) and I recently implemented the 3rd repetition draw logic in a way that did not seem to compromise performance too much (I could not detect any slowdown in nodes per second): 1) I have the typical MakeMove/TakeBack functions used in the searches 2) I also implemented ApplyMove/UndoMove functions that are used not by the search functions but only when the move is actually made (either by opponent or the engine). These are not executed as often so we can do more stuff here: 2a) In ApplyMove I save the board position in a board history stack/array. 2b) I search backwards to see if the current board is a duplicate of nay other board in history (BTW you don't need to look back past boards created by captures, promotions or pawn moves) 2c) If it is a duplicate I store it in a dups stack. 2d) If the current board was caused by a capture/pawn advance/promotion I clean the dups stack. 3) During the AB search I search through the dups stack for the current board and if found we have a draw by repetition ==> return 0. This way during the more frequent operation we only have to look through a few boards (the dups stack) looking for the 3rd repetition. That means that we may not evaluate correctly in general when the repetitions happen within a given search (we should give a value of zero to some board position far into the search but we will not) but I thought that it is a lesser evil to do that than to slow down everything to do it perfectly... At least if we are ahead we'll avoid the 3rd repetition (if we have better things to do) and if we are behind and we see an opportunity for a draw we'll jump on it... tell me if you find a better way to do this... Greg
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.