I ran into an issue with XBoard while running some Xiangqi games using SjaakII. SjaakII always sends "piece" commands, to tell XBoard how pieces move. These then override XBoard's build-in move tables - which is normally fine, since they should be the same for known variants.
The exception, it turns out, is Xiangqi, where XBoard was penalising SjaakII for making "false mate claims" whenever it mated through a contact check with a rook just outside the palace. Reason: XBoard now thought it would be legal for the king to capture the rook, since it was unaware that the king has to stay inside the palace.
There are two easy work-arounds: turn legality testing off in XBoard, which makes it believe engine claims, or disable sending of piece commands in SjaakII. One way or the other, the situation seems undesirable to me. I can think of a number of possible fixes:
1. Always believe engine claims if the engine sends piece commands.
2. Ignore piece commands for known variants.
3. Remember the presence of the palace.
The first may have undesired side-effects, but I believe the second would have no real draw-backs: at best, the piece commands reproduce the rules it already knows. At worst, they interfere with them. If the engine actually wants to play a different variant, it should not depend on changing the way pieces move in an existing variant (it should use a unique engine-defined variant name). The third would also fix the problem in this particular case, but doesn't address the wider issue.
XBoard: piece commands and engine claim problem
Moderator: Ras
-
Evert
- Posts: 2929
- Joined: Sat Jan 22, 2011 12:42 am
- Location: NL
-
hgm
- Posts: 28510
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: XBoard: piece commands and engine claim problem
This must be a bug, because XBoard is supposed to apply method (2) already. That is, if legality testing is on.
Only for some semi-supported variants, which formerly had to be played with legality testing off, and for pieces that used to be wild-cards (non-checking universal leapers) and were not used in any variant, the piece command should be always accepted.
I will see if I can find out why this happens.
Code: Select all
if(sscanf(message, "piece %s %s", buf2, buf1) == 2) {
ChessSquare piece = WhitePawn;
char *p=buf2;
if(*p == '+') piece = CHUPROMOTED WhitePawn, p++;
piece += CharToPiece(*p) - WhitePawn;
if(cps != &first || appData.testLegality && *engineVariant == NULLCHAR
/* always accept definition of */ && piece != WhiteFalcon && piece != BlackFalcon
/* wild-card pieces. */ && piece != WhiteCobra && piece != BlackCobra
/* For variants we don't have */ && gameInfo.variant != VariantBerolina
/* correct rules for, we cannot */ && gameInfo.variant != VariantCylinder
/* enforce legality on our own! */ && gameInfo.variant != VariantUnknown
&& gameInfo.variant != VariantGreat
&& gameInfo.variant != VariantFairy ) return;
I will see if I can find out why this happens.