Author: Richard Pijl
Date: 05:48:18 07/12/02
Go up one level in this thread
On July 12, 2002 at 08:38:57, José Carlos wrote: >On July 12, 2002 at 08:32:18, Richard Pijl wrote: > >>On July 12, 2002 at 08:08:20, Vladimir Medvedev wrote: >> >>>How to handle position repetitions during search? >>> >>>I use the following method: >>> >>>(pseudo-code) >>> >>>int CountSearchRepetitions[MAXSIZE]; >>>int CountHistoryRepetitions[MAXSIZE]; >>> >>>int AlphaBeta(Position pos, int alpha, int beta) >>>{ >>> if( current_ply > 0 && CountHistoryRepetitions[ pos.GetHash() % MAXSIZE ]>0 >>>) >>> { >>> return min( 0, beta ); >>> } >>> >>> if( CountSearchRepetitions[ pos.GetHash() % MAXSIZE ] > 1 ) >>> { >>> return min( 0, beta ); >>> } >>> >>> while( get_next_move() ) >>> { >>> pos.MakeMove(); >>> SearchRepetition[ pos.GetHash() % MAXSIZE ] ++; >>> int eval = - AlphaBeta( pos, -beta, -alpha ); >>> SearchRepetition[ pos.GetHash() % MAXSIZE ] --; >>> pos.UnmakeMove(); >>> >>> ........ >>> >>> } >>>} >>> >>>Is this correct? Shouldn't I return 0 instead min(0, beta)? >>>Is it good to add repetitions in game history to repetitions on the current >>>branch? >> >>- You will get many false repetitions as you are mapping many hashkeys on a >>single value ( by % MAXSIZE) >>- Do you take side-to-move, castling rights and the en-passant indicator in your >>hashkey? If not, that's another source of error > > Now that you mention it, I have en-passant and castling rights in my hash key >by I think _I_ have a source of error here, because neither en-passant or castle >rights should be counted for the 3rd repetition. AFAIK, it's only the position >of the pieces and side to move that matters. No! Having the possibility to castle or capture en-passant is part of the position so should be counted. > >>- returning min (0,beta) looks fine although in practice it probably doesn't >>matter much. >>- Game history should be counted, but make sure you do not evaluate repetitions >>in the rootnode as you need a move to be played ... > > Not if your opponent has made a move such that there's a 3 times repeated >position on the board. In that case, you can simply claim the draw. > Not by FIDE rules where you have to state a move you want to play which results in the third time the position occurred. E.g. when from the startposition white moves its kings knight to f3 and back, and black does the same with its knight (g8-f6 and back) black can claim a draw before making its fourth move stating the intention to play f6-g8. If black doesn't, white can by stating the move g1-f3. However, if white had played the sequence 1.Nf3 2.Ng1 3.Nc3 4.Nb1 it cannot claim a draw on any move as on either Nc3 or Nf3 the position only occurred twice. As computers cannot state the intention to play a move, draw claims based on third repetition should be made after making their own move. Richard.
This page took 0.01 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.