From 893ed0aaac95bf06a8b067bc179076c134ab044d Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 5 Feb 2015 19:34:32 +0100 Subject: [PATCH] Recognize castling double-moves from engine An engine could already send double-moves of the Alien protocol, where the same piece moved twice, which were then glued into a single step, with the intermediate square as trampled piece. Now when the second leg is whith a different piece, it keeps the first leg as overall move, and tramples the second mover. This translates castlings sent as two-piece moves to the kludge format of trampling the own 'Rook'. --- backend.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index be8956f..43df74d 100644 --- a/backend.c +++ b/backend.c @@ -8667,12 +8667,13 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h safeStrCpy(firstLeg, machineMove, 20); // just remember it for processing when second leg arrives return; } else if(firstLeg[0]) { // there was a previous leg; - // only support case where same piece makes two step (and don't even test that!) + // only support case where same piece makes two step char buf[20], *p = machineMove+1, *q = buf+1, f; safeStrCpy(buf, machineMove, 20); while(isdigit(*q)) q++; // find start of to-square safeStrCpy(machineMove, firstLeg, 20); - while(isdigit(*p)) p++; + while(isdigit(*p)) p++; // to-square of first leg (which is now copied to machineMove) + if(*p == *buf) // if first-leg to not equal to second-leg from first leg says unmodified (assume it ia King move of castling) safeStrCpy(p, q, 20); // glue to-square of second leg to from-square of first, to process over-all move sscanf(buf, "%c%d", &f, &killY); killX = f - AAA; killY -= ONE - '0'; // pass intermediate square to MakeMove in global firstLeg[0] = NULLCHAR; -- 1.7.0.4