From 1b936bccc1ce09ac1ea15a4186b3bbc51eacaaf8 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 17 Apr 2012 07:44:50 +0200 Subject: [PATCH] Translate S-Chess gating moves The only existing UCI S-Chess engine requires the gating square to be repeated after the gating piece suffix. Also gating-at-Rook castlings have a different format: they mention the King move. UCI2WB now handles these move translations. --- README.txt | 3 +++ UCI2WB.c | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/README.txt b/README.txt index 578495e..69cb2e8 100644 --- a/README.txt +++ b/README.txt @@ -47,6 +47,9 @@ H.G.Muller Change log: 17/4/2012 +Implement move translations required for variant seirawan + +17/4/2012 Make supported-variants string configurable from command line. 15/4/2012 v1.7 diff --git a/UCI2WB.c b/UCI2WB.c index 7f90ba6..26010a2 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -171,6 +171,8 @@ Engine2GUI() line[13] = '=', line[14] = 0; } } + if(line[9] == 'e' && (line[14] == 'a' || line[14] == 'h')) // seirawan castling + gating at Rook + line[9] = line[14], line[11] = 'e'; // convert to RxK notation printf("move %s\n", line+9); // send move to GUI if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == WHITE ? "1-0" : "0-1"); computer = NONE; } stm = WHITE+BLACK - stm; @@ -282,6 +284,11 @@ GUI2Engine() else if(line[13] != '\n') line[13] = '+'; // cater to WB 4.4 bug :-( } sscanf(line, "usermove %s", command); // strips off linefeed + if(command[4] && (command[1] == '1' || command[1] == '8')) { // seirawan gating + command[5] = command[0], command[6] = command[1], command[7] = '\0'; + if(command[2] == 'e' && (command[0] == 'a' || command[0] == 'h')) + command[2] = (command[0]+command[2]+1)>>1, command[0] = 'e'; // gating at Rook + } stm = WHITE+BLACK - stm; // when pondering we either continue the ponder search as normal search, or abort it if(pondering || computer == ANALYZE) { @@ -292,7 +299,8 @@ GUI2Engine() } StopPonder(1); } - sscanf(line, "usermove %s", move[moveNr++]); // possibly overwrites ponder move +// sscanf(line, "usermove %s", move[moveNr++]); // possibly overwrites ponder move + strcpy(move[moveNr++], command); } else if(!strcmp(command, "level")) { int sec = 0; -- 1.7.0.4