From d9d4e462f10fe222828adcc7ba6adfa833259208 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 24 Oct 2011 19:31:08 +0200 Subject: [PATCH] Let perpetual-chase message mention square 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 | 4 +++- moves.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index ed803ff..bac20d8 100644 --- 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 --- 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 } -- 1.7.0.4