Let perpetual-chase message mention square
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 24 Oct 2011 17:31:08 +0000 (19:31 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Mon, 24 Oct 2011 17:31:08 +0000 (19:31 +0200)
In stead of a boolean, PerpetualChase now returns the square the chased
piece ends on (encoded as an int), and on adjudication it will be printed.

backend.c
moves.c

index ed803ff..bac20d8 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7626,8 +7626,10 @@ Adjudicate(ChessProgramState *cps)
                                    hisPerpetual = PerpetualChase(k, forwardMostMove);
                                    ourPerpetual = PerpetualChase(k+1, forwardMostMove);
                                    if(ourPerpetual && !hisPerpetual) { // we are actively chasing him: forfeit
+                                       static char resdet[MSG_SIZ];
                                        result = WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins;
-                                       details = "Xboard adjudication: perpetual chasing";
+                                       details = resdet;
+                                       snprintf(resdet, MSG_SIZ, "Xboard adjudication: perpetual chasing of %c%c", ourPerpetual>>8, ourPerpetual&255);
                                    } else
                                    if(hisPerpetual && !ourPerpetual)   // he is chasing us, but did not repeat yet
                                        break; // Abort repetition-checking loop.
diff --git a/moves.c b/moves.c
index 0d8d146..093df63 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1947,5 +1947,6 @@ int PerpetualChase(int first, int last)
             }
         }
     }
-    return preyStackPointer; // if any piece was left on preyStack, it has been perpetually chased
+    return preyStackPointer ? 256*(preyStack[preyStackPointer].file - BOARD_LEFT + AAA) + (preyStack[preyStackPointer].rank + ONE)
+                               : 0; // if any piece was left on preyStack, it has been perpetually chased,and we return the
 }