Winboard 4.8.0b and Amazon chess variant

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Winboard 4.8.0b and Amazon chess variant

Post by Ferdy »

I am developing an amazon variant and testing it against Sjaak II 1.0.0 in a game under Machine Match mode.
Winboard added a dot after a move by my engine Matibay v0.1. This move with a dot was
sent to Sjaak by winboard and Sjaak indicated that the move is illegal.
The move itself is legal without a dot. This happened on whites's 45th move.

Winboard settings:
Test Legality is off
Ponder off
Adjudications/Verify Engine Claims is on
Adjudications/Detect Mates is on

Why winboard added a dot after a move?

Here is the later part of the debug file, first = Matibay, second = Sjaak.
613624 >second: f1g1
silence
613626 <second: 2 -41 1 435 45. ... Nd5 45. Aa5 Kc8 46. Axb5 Axb5 47. Bxb5
613630 <second: 3 -45 1 1365 45. ... b6 45. cxb6 Kxb6 46. Ae3 Kc6 47. Axg5
613640 <second: 4 -40 3 3846 45. ... Nd5 45. Ad4 Nf4 46. Axb5 Axb5 47. Bxb5
613660 <second: 5 -13 4 8695 45. ... b6 45. cxb6 Kxb6 46. Ag7 Ad5 47. Axg5
613680 <second: 6 -37 6 13739 45. ... b6 45. cxb6 Kxb6 46. Ae3 Ac5 47. Axg5 Ae4 48. Ae3 Axe3 49. fxe3
613721 <second: 7 -37 10 24211 45. ... b6 45. cxb6 Kxb6 46. Ae3 Ac5 47. Axg5 Ae4 48. Ae3 Axe3 49. fxe3
613863 <second: 8 -62 24 56968 45. ... Nd5 45. Aa5 Kb8 46. Axb5 Axb5 47. Bxb5 Kc7 48. a4
613946 <second: 9 -66 32 77324 45. ... Nd5 45. Aa5 Kb8 46. Axb5 Axb5 47. Bxb5 Nf4 48. a4 g4 49. hxg4 fxg4
614060 <second: 10 -66 43 105990 45. ... Nd5 45. Aa5 Kb8 46. Axb5 Axb5 47. Bxb5 Nf4 48. a4 g4 49. hxg4 fxg4
614445 <second: 11 -60 82 196891 45. ... Nd5 45. Aa5 Kb8 46. Axb5 Axb5 47. Bxb5 Nf4 48. a4 Kc7 49. a5 g4 50. hxg4 fxg4
614858 <second: 12 -60 124 295985 45. ... Nd5 45. Aa5 Kb8 46. Axb5 Axb5 47. Bxb5 Nf4 48. a4 Kc7 49. a5 g4 50. hxg4 fxg4
616618 <second: 13 -70 299 713030 45. ... Ac6 45. Bxb5 Ad5 46. Aa4 Kb8 47. Bc4 Ac6 48. Axc6 Nxc6 49. f3 Ne5 50. Bd5 Nd3 51. c6 bxc6 52. Bxc6
616619 <second: move d7c6
616619 >first : time 6502
616619 >first : otim 7852
book hit = (NULL)
616620 >first : d7c6
silence
616622 <first : # TimeLeft=65020.00ms. CT=6502ms, MT=3251.00ms AT=2857.00ms.
616622 <first : 1 157 0 68 c3d3
616623 <first : 2 142 0 786 e2f3 c6d7 c3g5 d7c5 g5h4
616623 <first : 3 172 0 916 e2f3 (1.0)
616624 <first : 3 262 0 1544 e2f3 b5b4 c3c4 (1.5)
616627 <first : 4 136 0 3389 c3h8 b7b6 e2f3 c6c5 (2.3)
616632 <first : 5 158 1 5608 c3h8 e7d5 e2f3 b5b4 h8a8 c7d7 (1.6)
616643 <first : 6 161 2 10880 e2f3 c6d7 c3h8 e7c8 g1h2 d7c5 (2.1)
616653 <first : 7 131 3 15503 e2f3 (1.4)
616654 <first : 7 144 3 16111 e2f3 c6d7 c3h8 e7c8 g1h2 d7c5 h8f7 c7b8 (1.5)
616693 <first : 8 119 7 35502 e2b5 c6d5 c3c2 c7b8 a3a4 f5f4 c2d3 d5e6 (2.1)
616727 <first : 9 126 10 52662 e2b5 c6d5 c3c2 c7b8 a3a4 f5f4 b5d3 e7c6 d3f5 (1.5)
616837 <first : 10 111 21 107354 e2b5 c6d5 c3c2 c7b8 a3a4 f5f4 b5d3 e7c6 d3e4 d5d4 e4d3 d4c2 d3c2 (2.0)
617097 <first : 11 105 47 237728 e2b5 c6d5 c3c2 d5e5 b5d3 c7b8 a3a4 g5g4 h3g4 f5g4 d3e2 g4g3 (2.2)
617721 <first : 12 113 110 550915 c3h8 c6d7 h8a8 c7c6 a8a7 c6d5 e2f3 d5e5 a7b7 d7b7 f3b7 e5d4 c5c6 e7d5 f2f3 d5c7 g1f2 (2.3)
618505 <first : 13 119 188 976156 c3h8 e7c8 h8g7 c8e7 g7f8 c6d8 f8f6 d8c6 f6g5 c6c5 e2b5 c5a3 g5e6 c7b8 e6d7 b8a7 (1.7)
619804 <first : 14 120 318 1661307 c3h8 e7c8 h8g7 c8e7 g7g5 c6c5 g5h4 c5a3 h4d4 a3c1 e2f1 c1c6 d4b5 c6b5 f1b5 c7b6 b5e8 b6c5 h3h4 (1.7)
619805 <first : move c3h8
619805 >second: time 7852
619805 >second: otim 6284
book hit = (NULL)
619806 >second: c3h8.
silence
619808 <second: Error (Illegal move or unknown command): c3h8.
GameEnds(29, xboard exit, 2)
GE(29, xboard exit, 2) bare king k=8 color=44
write FEN 50-move: 0 88 0
The game record.

Code: Select all

&#91;Event "Computer Chess Game"&#93;
&#91;Site "INTEL-PC"&#93;
&#91;Date "2015.12.05"&#93;
&#91;Round "1"&#93;
&#91;White "Matibay v0.1"&#93;
&#91;Black "Sjaak II 1.0.0 Amazon"&#93;
&#91;Result "*"&#93;
&#91;TimeControl "300+1"&#93;
&#91;Variant "amazon"&#93;
&#91;VariantMen "A&#58;QN"&#93;
&#91;FEN "rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1"&#93;
&#91;SetUp "1"&#93;

&#123;--------------
r n b a k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B A K B N R
white to play
--------------&#125;
1. Nf3 &#123;+0.32/16&#125; d5 &#123;-0.11/16 19&#125; 2. e3 &#123;+0.17/14 14&#125; Nf6 &#123;-0.02/14 15&#125; 3.
Nc3 &#123;+0.10/14 13&#125; c6 &#123;+0.14/15 8&#125; 4. d4 &#123;+0.43/15 13&#125; Ad6 &#123;+0.12/15 8&#125; 5.
Ad2 &#123;+0.85/13 12&#125; Nbd7 &#123;+0.23/13 7&#125; 6. Bd3 &#123;+0.92/14 9&#125; e5 &#123;+0.34/13 6&#125; 7.
e4 &#123;+0.49/13 11&#125; exd4 &#123;+0.07/13 9&#125; 8. Nxd4 &#123;+1.05/12 1.5&#125; dxe4 &#123;+0.05/12 6&#125;
9. Bxe4 &#123;+0.42/12 2.2&#125; Nc5 &#123;+0.04/12 8&#125; 10. Bf3 &#123;+0.31/12 10&#125; Be6
&#123;-0.07/12 5&#125; 11. O-O &#123;+0.53/13 10&#125; O-O-O &#123;-0.03/12 7&#125; 12. Nce2
&#123;+0.49/13 10&#125; Nce4 &#123;+0.06/10 6&#125; 13. Ae3 &#123;+0.38/12 9&#125; Bc4 &#123;+0.31/11 6&#125; 14.
b3 &#123;+0.45/12 5&#125; Bxe2 &#123;+0.02/12 8&#125; 15. Nf5 &#123;+0.22/13 9&#125; Ae6 &#123;+1.38/11 9&#125; 16.
Axa7+ &#123;+0.30/13 8&#125; Kc7 &#123;+0.98/11 10&#125; 17. Aa5+ &#123;+0.64/13 5&#125; Kb8 &#123;+0.00/11 6&#125;
18. Bf4+ &#123;+0.63/14 5&#125; Bd6 &#123;+1.22/11 6&#125; 19. Nxd6 &#123;+0.68/14 5&#125; Nxd6
&#123;-0.33/12 6&#125; 20. Bxd6+ &#123;+0.68/13 0.8&#125; Rxd6 &#123;-0.42/13 6&#125; 21. Rae1
&#123;+0.62/15 5&#125; Ad4 &#123;-0.63/13 5&#125; 22. Rxe2 &#123;+1.31/15 5&#125; Rd5 &#123;-0.79/14 7&#125; 23.
Ae1 &#123;+1.17/15 6&#125; Rd7 &#123;-0.78/14 8&#125; 24. Ac1 &#123;+1.23/14 6&#125; h6 &#123;-0.77/12 8&#125; 25.
a3 &#123;+1.14/14 7&#125; Kc7 &#123;-0.73/11 6&#125; 26. Rfe1 &#123;+1.21/14 5&#125; g5 &#123;-0.85/11 4&#125; 27.
h3 &#123;+1.33/13 6&#125; Nd5 &#123;-0.96/10 4&#125; 28. Rd2 &#123;+1.54/13 6&#125; Ac3 &#123;-1.15/13 7&#125; 29.
Rd3 &#123;+1.86/13 3&#125; Af6 &#123;-1.12/12 4&#125; 30. c4 &#123;+1.95/12 5&#125; Nf4 &#123;-0.98/13 3&#125; 31.
Rxd7+ &#123;+1.54/13 3&#125; Axd7 &#123;-0.75/12 4&#125; 32. Ac3 &#123;+1.23/13 5&#125; Ra8 &#123;-0.31/12 3&#125;
33. Bg4 &#123;+1.20/13 4&#125; f5 &#123;+0.00/13 3&#125; 34. Bf3 &#123;+1.30/13 4&#125; h5 &#123;-0.87/11 4&#125;
35. c5 &#123;+1.31/12 5&#125; Re8 &#123;-0.82/11 3&#125; 36. Rxe8 &#123;+1.27/13 4&#125; Axe8
&#123;-0.86/14 3&#125; 37. Kf1 &#123;+1.18/13 4&#125; h4 &#123;-0.79/14 3&#125; 38. Aa5+ &#123;+1.06/13 4&#125; Kb8
&#123;-0.81/15 5&#125; 39. Ac4 &#123;+0.84/14 4&#125; Kc7 &#123;-0.73/15 3&#125; 40. Ac3 &#123;+0.79/14 4&#125; Ad7
&#123;-0.86/14 3&#125; 41. b4 &#123;+0.93/15 3&#125; Ng6 &#123;-0.71/14 4&#125; 42. b5 &#123;+1.04/14 4&#125; cxb5
&#123;-0.70/13 3&#125; 43. Be2 &#123;+0.99/14 3&#125; Ne7 &#123;-0.71/14 3&#125; 44. Kg1 &#123;+0.80/14 3&#125; Ac6
&#123;-0.70/13 3&#125;
&#123;xboard exit &#40;Clocks&#58; 18, 79&#41;&#125; *
User avatar
hgm
Posts: 27791
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Winboard 4.8.0b and Amazon chess variant

Post by hgm »

It looks like a promotion character for an undefined piece.

I guess there is a problem here with the use of the spear symbol for Amazon. This symbol is also used for non-standard Pawns in some variants (because it is such a nice narrow symbol, and a rank of fat Pawns really look ugly). E.g. in Spartan Chess. And WinBoard knows Pawns must promote when it reaches last rank. So it must distinguish variants where the spear symbol represents a Pawn and where it represents a normal piece. IIRC the current version assumes it is a Pawn in all variants except Superchess (variant super), where it was in use for the QN compound.

I guess a better solution would be to have two pieces that use this same image, one always considered a Pawn, the other always a piece. I will keep that in mind when I increase the number of piece types in WB 4.9.

For now the solution is to either use parent variant super, or pick another symbol for the Amazon.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Winboard 4.8.0b and Amazon chess variant

Post by Ferdy »

hgm wrote:It looks like a promotion character for an undefined piece.

I guess there is a problem here with the use of the spear symbol for Amazon. This symbol is also used for non-standard Pawns in some variants (because it is such a nice narrow symbol, and a rank of fat Pawns really look ugly). E.g. in Spartan Chess. And WinBoard knows Pawns must promote when it reaches last rank. So it must distinguish variants where the spear symbol represents a Pawn and where it represents a normal piece. IIRC the current version assumes it is a Pawn in all variants except Superchess (variant super), where it was in use for the QN compound.

I guess a better solution would be to have two pieces that use this same image, one always considered a Pawn, the other always a piece. I will keep that in mind when I increase the number of piece types in WB 4.9.

For now the solution is to either use parent variant super, or pick another symbol for the Amazon.
It is working now, I changed the position of a/A in piecetochar table and also the parent variant.
Now it is,

Code: Select all

setup &#40;PNBRAKpnbrak&#41; 8x8+0_normal rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
It was,

Code: Select all

setup &#40;PNBR..............AKpnbr..............ak&#41; 8x8+0_fairy rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
Both have piece ID,

Code: Select all

piece A& QN
The gui is now showing a Queen for the Amazon piece.

Winboard now does not append a dot for that new piece that moves to the last rank. Thanks.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Winboard 4.8.0b and Amazon chess variant

Post by Ferdy »

Revised it again, I change the parent variant from normal to fairy because when playing against Sjaak, Sjaak rejects the natural move g1f3.

Now,

Code: Select all

setup &#40;PNBRAKpnbrak&#41; 8x8+0_fairy rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
was

Code: Select all

setup &#40;PNBRAKpnbrak&#41; 8x8+0_normal rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
User avatar
hgm
Posts: 27791
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Winboard 4.8.0b and Amazon chess variant

Post by hgm »

It is better to avoid using 'normal' as parent variant, because in variant normal WinBoard would not send a variant command. Variant fairy is an ideal parent variant, as it does not use any special rules different from 'normal', but will be receptive to 'setup' commands even when legality checking is on.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Winboard 4.8.0b and Amazon chess variant

Post by Evert »

hgm wrote: For now the solution is to either use parent variant super, or pick another symbol for the Amazon.
I'm tempted to go with the former, since I don't really like any of the other glyphs for the Amazon (not too fond of the spear either for that matter; Amazon is about the only piece for which I actually like the silly compound graphics).

I'll also move Amazon Chess to the config file so it's easier for users to wok around incompatibilities like this. Not that it's a particularly interesting game (the Amazon is overpowered on the tiny board and trading it results in a boring orthochess game).
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Winboard 4.8.0b and Amazon chess variant

Post by Ferdy »

Evert wrote:
hgm wrote: For now the solution is to either use parent variant super, or pick another symbol for the Amazon.
I'm tempted to go with the former, since I don't really like any of the other glyphs for the Amazon (not too fond of the spear either for that matter; Amazon is about the only piece for which I actually like the silly compound graphics).

I'll also move Amazon Chess to the config file so it's easier for users to wok around incompatibilities like this. Not that it's a particularly interesting game (the Amazon is overpowered on the tiny board and trading it results in a boring orthochess game).
If I use parent super and using this setup,

Code: Select all

setup &#40;PNBR..............AKpnbr..............ak&#41; 8x8+0_super rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
I still get an error, the queen reaching the last rank is still a problem.

Code: Select all

&#91;Event "Computer Chess Game"&#93;
&#91;Site "INTEL-PC"&#93;
&#91;Date "2015.12.06"&#93;
&#91;Round "1"&#93;
&#91;White "Matibay v1.1"&#93;
&#91;Black "Fairy-Max 4.8R Amazon"&#93;
&#91;Result "0-1"&#93;
&#91;TimeControl "300+1"&#93;
&#91;Variant "amazon"&#93;
&#91;VariantMen "A&#58;QN"&#93;
&#91;FEN "rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1"&#93;
&#91;SetUp "1"&#93;

&#123;--------------
r n b a k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B A K B N R
white to play
--------------&#125;
1. Nf3 &#123;+0.42/16&#125; c5 &#123;+0.15/9 19&#125; 2. e4 &#123;+0.90/14 7&#125; d5 &#123;+0.11/9 9&#125; 3. exd5
&#123;+1.39/15 14&#125; Axd5 &#123;-0.13/9 9&#125; 4. Nc3 &#123;+1.31/17 13&#125; Ad6 &#123;-0.09/8 4&#125; 5. d4
&#123;+1.35/13 7&#125; Bf5 &#123;+0.01/8 5&#125; 6. Ae3 &#123;+2.00/13 6&#125; e6 &#123;-0.22/8 4&#125; 7. Nb5
&#123;+1.43/13 12&#125; Ac6 &#123;-0.08/7 5&#125; 8. d5 &#123;+2.26/12 8&#125; Ad7 &#123;-0.28/8 7&#125; 9. g4
&#123;+3.79/13 5&#125; Bg6 &#123;-0.60/9 4&#125; 10. Ne5 &#123;+4.55/13 8&#125; Ab6 &#123;-0.78/9 12&#125; 11. dxe6
&#123;+6.51/14 10&#125; fxe6 &#123;-2.74/9 6&#125; 12. Nxg6 &#123;+7.23/15 8&#125; hxg6 &#123;-4.83/10 5&#125; 13.
Ae5 &#123;+7.67/15 6&#125; Nf6 &#123;-5.55/9 6&#125; 14. Bf4 &#123;+7.63/14 5&#125; Aa5+ &#123;-4.71/8 4&#125; 15.
c3 &#123;+10.54/16 8&#125; Ac6 &#123;-6.58/10 9&#125; 16. Axg6+ &#123;+11.37/16 5&#125; Kd7 &#123;-6.64/9 9&#125;
17. O-O-O+ &#123;+11.67/17 6&#125; Kc8 &#123;-6.63/9 3&#125; 18. Axh8 &#123;+11.43/17 9&#125; Nbd7
&#123;-7.73/10 4&#125; 19. Nd6+ &#123;+14.75/17 5&#125; Kb8 &#123;-7.77/9 10&#125; 20. Nf7+ &#123;+15.09/17 5&#125;
Kc8 &#123;-8.98/9 6&#125; 21. Bb5 &#123;+18.90/16 4&#125; Ae7 &#123;-12.10/11 5&#125; 22. Nd6+
&#123;+21.83/16 5&#125; Kd8 &#123;-9.78/9 3&#125; 23. Nxb7+ &#123;+24.18/17 5&#125; Kc8 &#123;-12.47/11 14&#125;
24. Nd6+ &#123;+25.18/16 6&#125; Kd8 &#123;-13.65/11 7&#125; 25. Nf7+ &#123;+35.76/14 5&#125; Ke8
&#123;-16.43/11 6&#125; 26. Ne5 &#123;+299.83/14 6&#125; a6 &#123;-18.09/11 6&#125; 27. Bxd7+
&#123;+299.87/13 5&#125; Nxd7 &#123;-79.94/14 5&#125; 28. Rxd7 &#123;+299.89/13 0.5&#125; Axd7
&#123;-79.95/14 2.9&#125;
&#123;Xboard&#58; Forfeit due to invalid move&#58; h8g6 &#40;h8g6 via `0&#41; res=24&#125; 0-1
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Winboard 4.8.0b and Amazon chess variant

Post by Evert »

Ferdy wrote:
Evert wrote:
hgm wrote: For now the solution is to either use parent variant super, or pick another symbol for the Amazon.
I'm tempted to go with the former, since I don't really like any of the other glyphs for the Amazon (not too fond of the spear either for that matter; Amazon is about the only piece for which I actually like the silly compound graphics).

I'll also move Amazon Chess to the config file so it's easier for users to wok around incompatibilities like this. Not that it's a particularly interesting game (the Amazon is overpowered on the tiny board and trading it results in a boring orthochess game).
If I use parent super and using this setup,

Code: Select all

setup &#40;PNBR..............AKpnbr..............ak&#41; 8x8+0_super rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
I still get an error, the queen reaching the last rank is still a problem.
I actually get a segfault when trying to use "super" as a parent variant, I'll see if an XBoard update fixes that.

I wondered whether it would be useful to accept "." promotions, but probably not: XBoard probably thinks the piece "promoted" to Queen and only prints a . because that's what's in pieceToChar. It would ameliorate the situation if promotion would be suppressed if no promotion character is specified and pieceToChar doesn't specify the Queen (ie, has "." in its place). Of course things would still break if the Queen and Amazon both participate in the game, but there aren't that many high-power chess variants where that problem would show up...

EDIT:

There's actually another (potential) issue, at least with my version of XBoard: when reading the PGN tags, it sends the "variant" command to the engine, but then it starts processing the moves before it receives any "piece" commands:

Code: Select all

Parsed game start '&#91;Event "Computer Chess Game"&#93;' &#40;39&#41;
Parsed PGNTag&#58; &#91;Event "Computer Chess Game"&#93;
Parsed PGNTag&#58; &#91;Site "INTEL-PC"&#93;
Parsed PGNTag&#58; &#91;Date "2015.12.06"&#93;
Parsed PGNTag&#58; &#91;Round "1"&#93;
Parsed PGNTag&#58; &#91;White "Matibay v1.1"&#93;
Parsed PGNTag&#58; &#91;Black "Fairy-Max 4.8R Amazon"&#93;
Parsed PGNTag&#58; &#91;Result "0-1"&#93;
Parsed PGNTag&#58; &#91;TimeControl "300+1"&#93;
Parsed PGNTag&#58; &#91;Variant "amazon"&#93;
Parsed PGNTag&#58; &#91;VariantMen "A&#58;QN"&#93;
Parsed PGNTag&#58; &#91;FEN "rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1"&#93;
shuffleOpenings = 0
FEN castling rights&#58; 7 0 4 7 0 4
Parsed PGNTag&#58; &#91;SetUp "1"&#93;
Parsed Comment&#58; &#123;-------------- 
r n b a k b n r 
p p p p p p p p 
. . . . . . . . 
. . . . . . . . 
. . . . . . . . 
. . . . . . . . 
P P P P P P P P 
R N B A K B N R 
white to play 
--------------&#125;
Append&#58; in='&#123;-------------- 
r n b a k b n r 
p p p p p p p p 
. . . . . . . . 
. . . . . . . . 
. . . . . . . . 
. . . . . . . . 
P P P P P P P P 
R N B A K B N R 
white to play 
--------------&#125;' 0
3459 >first &#58; memory 6148
3459 >first &#58; new
random
3459 >first &#58; variant amazon
3459 >first &#58; level 40 0&#58;10 0
3459 >first &#58; post
3459 >first &#58; hard
3459 >first &#58; easy
3459 >first &#58; ping 2
Impossible move e7d7, type = 0
3459 >first &#58; force
write FEN 50-move&#58; 0 0 0
e0. p=-6
3459 >first &#58; setboard rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq - 0 1
Load Game
Parsed Nf3 into g1f3
Parsed Comment&#58; &#123;+0.42/16&#125;
Append&#58; in='&#123;+0.42/16&#125;' 0
Parsed c5 into c7c5
Parsed Comment&#58; &#123;+0.15/9 19&#125;
Append&#58; in='&#123;+0.15/9 19&#125;' 0
Parsed e4 into e2e4
Parsed Comment&#58; &#123;+0.90/14 7&#125;
Append&#58; in='&#123;+0.90/14 7&#125;' 0
Parsed d5 into d7d5
Parsed Comment&#58; &#123;+0.11/9 9&#125;
Append&#58; in='&#123;+0.11/9 9&#125;' 0
Parsed exd5 into e4d5
Parsed Comment&#58; &#123;+1.39/15 14&#125;
Append&#58; in='&#123;+1.39/15 14&#125;' 0
Parsed Axd5 into d8d5
Parsed Comment&#58; &#123;-0.13/9 9&#125;
Append&#58; in='&#123;-0.13/9 9&#125;' 0
Parsed Nc3 into b1c3
Parsed Comment&#58; &#123;+1.31/17 13&#125;
Append&#58; in='&#123;+1.31/17 13&#125;' 0
Parsed Ad6 into d5d6
Parsed Comment&#58; &#123;-0.09/8 4&#125;
Append&#58; in='&#123;-0.09/8 4&#125;' 0
Parsed d4 into d2d4
Parsed Comment&#58; &#123;+1.35/13 7&#125;
Append&#58; in='&#123;+1.35/13 7&#125;' 0
Parsed Bf5 into c8f5
Parsed Comment&#58; &#123;+0.01/8 5&#125;
Append&#58; in='&#123;+0.01/8 5&#125;' 0
Parsed Ae3 into d1e3
Parsed Comment&#58; &#123;+2.00/13 6&#125;
Append&#58; in='&#123;+2.00/13 6&#125;' 0
Parsed e6 into e7e6
Parsed Comment&#58; &#123;-0.22/8 4&#125;
Append&#58; in='&#123;-0.22/8 4&#125;' 0
Parsed Nb5 into c3b5
Parsed Comment&#58; &#123;+1.43/13 12&#125;
Append&#58; in='&#123;+1.43/13 12&#125;' 0
Parsed Ac6 into d6c6
Parsed Comment&#58; &#123;-0.08/7 5&#125;
Append&#58; in='&#123;-0.08/7 5&#125;' 0
Parsed d5 into d4d5
Parsed Comment&#58; &#123;+2.26/12 8&#125;
Append&#58; in='&#123;+2.26/12 8&#125;' 0
Parsed Ad7 into c6d7
Parsed Comment&#58; &#123;-0.28/8 7&#125;
Append&#58; in='&#123;-0.28/8 7&#125;' 0
Parsed g4 into g2g4
Parsed Comment&#58; &#123;+3.79/13 5&#125;
Append&#58; in='&#123;+3.79/13 5&#125;' 0
Parsed Bg6 into f5g6
Parsed Comment&#58; &#123;-0.60/9 4&#125;
Append&#58; in='&#123;-0.60/9 4&#125;' 0
Parsed Ne5 into f3e5
Parsed Comment&#58; &#123;+4.55/13 8&#125;
Append&#58; in='&#123;+4.55/13 8&#125;' 0
Parsed Ab6 into d7b6
Parsed Comment&#58; &#123;-0.78/9 12&#125;
Append&#58; in='&#123;-0.78/9 12&#125;' 0
Parsed dxe6 into d5e6
Parsed Comment&#58; &#123;+6.51/14 10&#125;
Append&#58; in='&#123;+6.51/14 10&#125;' 0
Parsed fxe6 into f7e6
Parsed Comment&#58; &#123;-2.74/9 6&#125;
Append&#58; in='&#123;-2.74/9 6&#125;' 0
Parsed Nxg6 into e5g6
Parsed Comment&#58; &#123;+7.23/15 8&#125;
Append&#58; in='&#123;+7.23/15 8&#125;' 0
Parsed hxg6 into h7g6
Parsed Comment&#58; &#123;-4.83/10 5&#125;
Append&#58; in='&#123;-4.83/10 5&#125;' 0
Parsed Ae5 into e3e5
Parsed Comment&#58; &#123;+7.67/15 6&#125;
Append&#58; in='&#123;+7.67/15 6&#125;' 0
Parsed Nf6 into g8f6
Parsed Comment&#58; &#123;-5.55/9 6&#125;
Append&#58; in='&#123;-5.55/9 6&#125;' 0
Parsed Bf4 into c1f4
Parsed Comment&#58; &#123;+7.63/14 5&#125;
Append&#58; in='&#123;+7.63/14 5&#125;' 0
Parsed Aa5 into b6a5
Parsed Comment&#58; &#123;-4.71/8 4&#125;
Append&#58; in='&#123;-4.71/8 4&#125;' 0
Parsed c3 into c2c3
Parsed Comment&#58; &#123;+10.54/16 8&#125;
Append&#58; in='&#123;+10.54/16 8&#125;' 0
Parsed Ac6 into a5c6
Parsed Comment&#58; &#123;-6.58/10 9&#125;
Append&#58; in='&#123;-6.58/10 9&#125;' 0
Parsed Axg6 into e5g6
Parsed Comment&#58; &#123;+11.37/16 5&#125;
Append&#58; in='&#123;+11.37/16 5&#125;' 0
Parsed Kd7 into e8d7
Parsed Comment&#58; &#123;-6.64/9 9&#125;
Append&#58; in='&#123;-6.64/9 9&#125;' 0
&#40;2-type&#41; castling 4 2
Parsed O-O-O into e1c1
Parsed Comment&#58; &#123;+11.67/17 6&#125;
Append&#58; in='&#123;+11.67/17 6&#125;' 0
Parsed Kc8 into d7c8
Parsed Comment&#58; &#123;-6.63/9 3&#125;
Append&#58; in='&#123;-6.63/9 3&#125;' 0
Parsed ImpossibleMove &#40;type = 25&#41;&#58; Axh8
AutoPlayOneMove&#40;)&#58; current 0
3709 >first &#58; g1f3
LoadGame&#40;)&#58; on exit, gameMode 7
3711 <first &#58; setup &#40;PNBR..............AKpnbr..............ak&#41; 8x8+0_fairy rnbakbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBAKBNR w KQkq -
3711 <first &#58; piece N& N
3711 <first &#58; piece B& B
3711 <first &#58; piece R& R
3711 <first &#58; piece A& QN
3711 <first &#58; piece K& KisO2
3711 <first &#58; piece P& fmWfceFifmW2
3711 <first &#58; pong 2
Now, this isn't an issue here because the variant was already "amazon", but I could imagine this being an issue in other situations.
User avatar
hgm
Posts: 27791
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Winboard 4.8.0b and Amazon chess variant

Post by hgm »

Evert wrote:I wondered whether it would be useful to accept "." promotions, but probably not: XBoard probably thinks the piece "promoted" to Queen and only prints a . because that's what's in pieceToChar.
That is exactly what happens. In principle it is an illegal move to not specify a promotion suffix on promotions that have a choice. But because some engines not supproting under-promotion did omit such a suffix, XBoard always assumed promotion to Queen as a default. With as a result there are now zillions of engines that omit the promotion suffix. So I could not make XBoard more strict without breaking all of those. But it causes a problem in variants where a Queen is not participating.
It would ameliorate the situation if promotion would be suppressed if no promotion character is specified and pieceToChar doesn't specify the Queen (ie, has "." in its place). Of course things would still break if the Queen and Amazon both participate in the game, but there aren't that many high-power chess variants where that problem would show up...
I think the development version should have this already fixed, in the sense that it will at least gives you a piece for which an ID is defined. (IIRC I have it run through the piece-to-char upwards from Q until it encounters a defined piece.)

Of course that does not fix the problem that a 'Lance' should not promote in the first place, when it represents an Amazon rather than a Hoplit or other kind of exo-Pawn. I think the long-term solution is simply to supply two pieces both represented by this image, one assumed to be a Pawn (and thus auto-promote), the other a normal piece (so it can be defined as Amazon).

I have to increase the number of pieces in XBoard anyway, to handle Dai Shogi. (Which HaChu already plays.) The way I am doing this in the development version is insert more pieces between Lion and King. The Chu-Shogi promoted pieces are already living there in 4.8.0, (because Chu needed what are normally considered the promoted series, piece 11-21, as base pieces), but were never officially defined. So in variant chu (which should be the parent variant for games with a huge number of pieces) there now is an unspecified number of base pieces, which is then followed by an eqal number of chu-promoted pieces, which is followed by a King. To indicate in the pieceToCharTable that you want to start assigning IDs to chu-promoted pieces will require a non-alphabetic symbol (in the current development version ':', but I will probably change that to '&'). So that engines can specify IDs for the chu-promoted series independently of how many base pieces there are, and future expansion of the number of base pieces will always remain possible in a contiguous and backward-compatible way. The development version will already have extra pieces, to make Dai Shogi, Cashew Shogi and Macadamia Shogi representable.

I have not assigned images to those yet, and I am wondering if it would make sense to supply extra default images for them. As only very few variants would need so many pieces, it might be better to leave defining the images to those variants. I can always make the first of these new pieces (nr 22, the one directly behind Lion) make duplicat use of the Lance.svg, however, and use that for Amazon in the standard variant super, so that the Lance (piece 18) is always an auto-promoting Pawn. I made a new fall-back mechanism for undefined pieces as well: if an image is not found in the pieceImageDirectory, it now first looks in that directory for a file named White/BlackTile.svg, before trying the original name in the default piece directory. The idea is that by supplying the image of a blank Shogi tile here Shogi variants would have all their pieces defined with just a single pair of SVG files. They would all be blank, but a new option -inscriptions <UTF8 string> (the string having pieceToCharTable format) could render kanji (or Latin characters) on top of them to make them look different.
There's actually another (potential) issue, at least with my version of XBoard: when reading the PGN tags, it sends the "variant" command to the engine, but then it starts processing the moves before it receives any "piece" commands:
...
Now, this isn't an issue here because the variant was already "amazon", but I could imagine this being an issue in other situations.
Indeed, this is a nasty problem. The Alien Edition was also suffering from this in variant alien, where every subsequent move could only be parsed reliably if the engine had first sent a board update for the result of the previous move.

It is not really easy to set up a dialog between GUI and engine to fix this. You would have to abort the LoadGamePGN function when you discover it is an engine-defined variant different from the one the GUI is currently set to, but then remember somehow that it still has to be done. And then send 'new' + 'variant' to the engine, to trigger the sending of 'setup' and 'piece' commands. And then after receiving them resume loading/parsing the game. I guess we could use 'ping' to make sure we received the last 'piece' command, so that resumption of the game loading would have to be initiated from the pong handler. It can all be done, but it is pretty awkward. And it would make ping=1 mandatory for engines with engine-defined variants. (But I can live with that; ping should have been mandatory for any v2 engine anyway.)

Considering the time pressure I faced when introducing the piece commands (to get an interface for HaChu into the upcoming Debian release), requiring that you should already be in the variant when you load a game for it seemed a good temporary solution.