From d5de5c406540b053c30e9732ae6c7b93c594bf27 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 11 Jul 2011 20:33:17 +0200 Subject: [PATCH] Fix rep-draw detection The comparison with previous positions started one half-move too late, so that a third repetition was not recognized if the first occurrence was created by an irreversible move. --- lasker-2.2.3/src/gameproc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lasker-2.2.3/src/gameproc.c b/lasker-2.2.3/src/gameproc.c index 8398499..53147a8 100644 --- a/lasker-2.2.3/src/gameproc.c +++ b/lasker-2.2.3/src/gameproc.c @@ -890,13 +890,14 @@ static int CheckRepetition (int p, int g) if (game_globals.garray[g].numHalfMoves < 8) /* can't have three repeats any quicker. */ return 0; - for (move_num = game_globals.garray[g].game_state.lastIrreversable; + for (move_num = game_globals.garray[g].game_state.lastIrreversable - 1; // [HGM] FEN stored in moveList[numHalfMoves-1] ! move_num < game_globals.garray[g].numHalfMoves - 1; move_num++) { pos = GetFENpos (g, move_num); if (strlen(pos1) == strlen(pos) && !strcmp(pos1, pos)) flag1++; if (strlen(pos2) == strlen(pos) && !strcmp(pos2, pos)) flag2++; +printf("%2d. %d-%d %s %s %s\n", move_num, flag1, flag2, pos1,pos2,pos); } if (flag1 >= 3 || flag2 >= 3) { if ((pend = find_pend(pp->opponent, p, PEND_DRAW)) != NULL) { -- 1.7.0.4