Fix rep-draw recognition
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 29 Mar 2010 07:57:48 +0000 (09:57 +0200)
committerArun Persaud <arun@nubati.net>
Wed, 31 Mar 2010 02:43:22 +0000 (19:43 -0700)
The refactoring had broken the rep-draw recognition, by adding and extra
condition in a conditional with side effects. The testing of this extra
condition is now moved to after the side effect.

backend.c

index 36b6dd3..7672207 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -6772,7 +6772,7 @@ Adjudicate(ChessProgramState *cps)
                    || NrWN==2 || NrBN==2     /* KNNK */
                    || NrWN+NrWB == 1 && NrBN+NrBB == 1 /* KBKN, KBKB, KNKN */
                   ) ) {
-                     if(canAdjudicate && --moveCount < 0 && appData.trivialDraws)
+                     if(--moveCount < 0 && appData.trivialDraws && canAdjudicate)
                      {    /* if the first 3 moves do not show a tactical win, declare draw */
                          if(engineOpponent) {
                            SendToProgram("force\n", engineOpponent); // suppress reply
@@ -6823,7 +6823,7 @@ Adjudicate(ChessProgramState *cps)
                                 boards[forwardMostMove][CASTLING][4] != boards[k][CASTLING][4] )
                                    rights++;
                         }
-                        if( canAdjudicate && rights == 0 && ++count > appData.drawRepeats-2
+                        if( rights == 0 && ++count > appData.drawRepeats-2 && canAdjudicate
                             && appData.drawRepeats > 1) {
                              /* adjudicate after user-specified nr of repeats */
                             if(engineOpponent) {