From: H.G.Muller <hgm@hgm-xboard.(none)>
Date: Wed, 21 Sep 2016 12:26:07 +0000 (+0200)
Subject: Handle USI win claims
X-Git-Tag: v2.3~20
X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1f508cfef32d91d668bdac6a0d9ad303012ae46d;p=uci2wb.git

Handle USI win claims

USI engines can emit 'bestmove win' to claim a win, e.g. because
of the point count in an impasse situation. This is traslated to
a CECP result claim in favor of the side to move, with REASON "claim".
---

diff --git a/UCI2WB.c b/UCI2WB.c
index c3129f5..459c748 100644
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -251,6 +251,7 @@ Engine2GUI()
 	    // move was a move to be played
 	    if(p = strstr(line+8, " draw")) *p = 0, printf("offer draw\n"); // UCCI
 	    if(strstr(line+9, "resign")) { printf("resign\n"); computer = NONE; }
+	    if(strstr(line+9, "win")) { printf("%s {claim}\n", stm== WHITE ? "1-0" :"0-1"); computer = NONE; } // USI
 	    if(strstr(line+9, "(none)") || strstr(line+9, "null") ||
 	       strstr(line+9, "0000")) { printf("%s\n", lastScore < -99999 ? "resign" : "1/2-1/2 {stalemate}"); computer = NONE; }
 	    sscanf(line, "bestmove %s", move[moveNr++]);