OK, this is a bit of a complex story:
I was still working on some backlogged complaints from Keith, to see if they were XBoard problems or Sjaak problems. This was in the Euro-Shogi, which I defined in the variants.txt as follows:
Code: Select all
#############
# EuroShogi #
#############
Variant: EuroShogi (8x8)
Board: 8x8
FEN: "1nbgkgn1/1r4b1/pppppppp/8/8/PPPPPPPP/1B4R1/1NGKGBN1"
XBoard pieces: "PNBR.....G.++++Kpnbr.....g.++++k"
XBoard parent: "shogi"
Zone: white_promotion = a8,b8,c8,d8,e8,f8,g8,h8,a7,b7,c7,d7,e7,f7,g7,h7,a6,b6,c6,d6,e6,f6,g6,h6
Zone: black_promotion = a3,b3,c3,d3,e3,f3,g3,h3,a2,b2,c2,d2,e2,f2,g2,h2,a1,b1,c1,d1,e1,f1,g1,h1
# Define the pieces
Piece: Knight
Move: aleap (1,2)|(-1,2)|(1,0)|(-1,0)
Symbol: "N", "N,n"
Promotion: white_promotion, black_promotion, "+"
Value: 250
Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Promotion: white_promotion, black_promotion, "+"
Value: 575
Piece: Gold general
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1)
Symbol: "G", "G,g"
Value: 450
Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Promotion: white_promotion, black_promotion, "+"
Value: 650
Piece: Pawn
Move: step N
Symbol: "P", "P,p"
Promotion: white_promotion, black_promotion, "+"
Flags: drop_no_mate, drop_one_file
Value: 80
Piece: Promoted Knight
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1)
Symbol: "+N", "+N,+n"
Value: 500
Piece: Dragon Horse
Move: slide (D,A)
Move: leap (1, 0)
Symbol: "+B", "+B,+b"
Value: 825
Piece: Dragon King
Move: slide (H,V)
Move: leap (1, 1)
Symbol: "+R", "+R,+r"
Value: 950
Piece: Promoted Pawn
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1)
Symbol: "+P", "+P,+p"
Value: 530
Piece: King
Move: leap (0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal
Rule: keep capture, allow drops
Rule: repeat4 = draw
Part of the illegal-move problems could be traced to the XBoard default assumption that a promotion zone on an 8-rank Shogi board is 2 ranks deep, which is wrong for Euro-Shogi, where it is 3 ranks. So to not flag promotions on 6th-rank as illegal, legality testing has to be off. There still was an illegal move e6g8+ in a debug excerpt though, for which I did not have the full game. So I started playing some eng-eng games myself. The second did end in an illegal move:
Code: Select all
[Event "Computer Chess Game"]
[Site "hgm-xboard"]
[Date "2015.02.18"]
[Round "-"]
[White "Sjaak II 1.0"]
[Black "Sjaak II 1.0"]
[Result "1-0"]
[TimeControl "40/60"]
[Variant "euroshogi"]
[VariantMen "P:fW;N:sWffN;B:B;R:R;G:WfF;+P:WfF;+N:WfF;+B:BW;+R:RF;K:K;+p:WfF;+n:WfF;+b:BW;+r:RF"]
[FEN "1nbgkgn1/1r4b1/pppppppp/8/8/PPPPPPPP/1B4R1/1NGKGBN1[-] w 0 1"]
[SetUp "1"]
{--------------
. n b g k g n .
. r . . . . b .
p p p p p p p p
. . . . . . . .
. . . . . . . .
P P P P P P P P
. B . . . . R .
. N G K G B N .
white to play
--------------}
1. f4 {+0.06/8} c5 {-0.10/8 1.3} 2. Rf2 {+0.12/9 1.3} Re7 {-0.06/9 1.3} 3.
Bg2 {+0.08/9 1.5} e5 {-0.08/8 1.0} 4. Kc2 {+0.08/8 1.5} Kf7 {-0.26/6 1.1}
5. Nf3 {+0.19/7 1.3} Ke8 {-0.40/6 0.9} 6. Ge2 {+0.63/7 2.8} b5
{-0.47/6 1.1} 7. c4 {+0.42/7 1.5} cxc4 {-0.47/6 1.4} 8. Nxe5 {+0.47/5 1.1}
P@e6 {+1.40/6 1.6} 9. P@c5 {-1.43/6 1.1} Rc7 {+2.45/6 1.7} 10. Be4
{-2.45/5 0.9} exe5 {+1.09/5 1.1} 11. Bxg6+ {-2.48/5 1.4} N@f7 {+2.27/5 1.6}
12. Bxe5 {-2.27/5 1.2} Ke7 {+3.30/6 1.7} 13. Bd4 {-2.79/5 0.8} Bxh3+
{+3.59/5 0.9} 14. f5 {-2.83/5 1.5} fxf5 {+2.83/4 1.2} 15. +Bxf5
{-4.04/4 0.9} +Bxf5 {+3.93/5 1.1} 16. Rxf5 {-3.48/5 1.9} B@h3 {+4.37/4 0.9}
17. B@g6 {-4.37/3 1.3} Bxd4 {+4.37/4 1.0} 18. dxd4 {-10.14/4 1.2} Gg7
{+6.77/4 4} 19. B@h7 {-9.46/3 1.0} Nf8 {+10.41/4 1.1} 20. Bxf7=
{-9.50/5 2.4} Gxh7 {+11.04/4 2.7} 21. N@g4 {-10.90/4 3} Gg6 {+11.04/3 1.0}
22. Rf2 {-11.20/4 1.0} Rxc5 {+11.56/5 9} 23. Kd3 {-9.97/3 0.8} B@f5
{+12.62/3 1.6} 24. Rxf5 {-13.80/2 1.6} Gxf5 {+17.99/3 0.7} 25. B@b6
{-12.77/2 1.6}
{Xboard: Forfeit due to invalid move: g6f5 (g6f5 via ^0) res=24} 1-0
Note that this might be a red herring, as I think I was still using the version to which you published the link here, and not the official RC4. So if it looks like the result of a familiar bug, you have already fixed, just ignore this.
The illegal move is actually a repetition of the previous move; it seems Sjaak fails to find a move here, and just repeats the previous one it played. The thinking output was:
Code: Select all
dep score nodes time (not shown: tbhits knps seldep)
2 0.00 196658 0:01.32 25. ...
Then I upgraded to RC4, and again played a few games. No illegal moves now, but I did see something suspect:
Code: Select all
[Event "Computer Chess Game"]
[Site "hgm-xboard"]
[Date "2015.02.18"]
[Round "-"]
[White "Sjaak II 1.0 RC4"]
[Black "Sjaak II 1.0 RC4"]
[Result "0-1"]
[TimeControl "40/60"]
[Variant "euroshogi"]
[VariantMen "P:fW;N:sWffN;B:B;R:R;G:WfF;+P:WfF;+N:WfF;+B:BW;+R:RF;K:K;+p:WfF;+n:WfF;+b:BW;+r:RF"]
[FEN "1nbgkgn1/1r4b1/pppppppp/8/8/PPPPPPPP/1B4R1/1NGKGBN1[-] w 0 1"]
[SetUp "1"]
{--------------
. n b g k g n .
. r . . . . b .
p p p p p p p p
. . . . . . . .
. . . . . . . .
P P P P P P P P
. B . . . . R .
. N G K G B N .
white to play
--------------}
1. Kc2 {+0.00/8} f5 {-0.10/8 1.5} 2. g4 {-0.05/8 1.5} Bf6 {-0.05/8 1.1} 3.
c4 {-0.10/7 0.9} e5 {+0.07/7 0.9} 4. Rf2 {-0.03/8 1.1} Be6 {-0.07/8 1.6} 5.
f4 {+0.19/9 2.0} fxf4 {-0.18/8 1.5} 6. Rxf4 {-0.01/8 1.2} P@f5
{+0.02/7 0.9} 7. Rf2 {+0.06/7 0.9} b5 {-0.12/7 1.5} 8. Bc3 {+0.00/7 1.6}
Nc8 {-0.59/6 1.4} 9. Nf3 {+0.13/7 2.6} e4 {-0.13/7 1.5} 10. exe4
{+0.34/7 1.4} Bxc3+ {-0.81/6 0.9} 11. Nxc3 {+0.12/6 1.6} Nf6 {-1.02/6 1.6}
12. B@e5 {+0.71/6 1.4} B@g7 {-0.80/6 1.1} 13. g5 {+1.39/6 1.4} gxg5
{-1.39/6 1.8} 14. Re2 {+0.45/6 1.2} g4 {-0.67/6 0.9} 15. Ng5 {+0.47/6 1.6}
Gg8 {-0.34/5 1.1} 16. Kd1 {+0.34/5 1.8} Kd7 {-0.19/6 1.6} 17. Gc2
{+0.15/5 0.9} b4 {-0.27/5 1.0} 18. bxb4 {+0.24/4 1.7} Rxb4 {-0.87/6 1.4}
19. Gb3 {+0.26/6 1.5} Rb7 {-0.56/6 1.7} 20. P@b5 {+0.73/5 1.9} Gc7
{-0.57/5 1.5} 21. Kc2 {+0.54/6 1.6} P@b6 {-0.59/5 0.9} 22. b5xb6=+
{+0.47/6 1.2} Nxb6 {+0.40/6 2.6} 23. Nb5 {-0.40/5 1.5} Nxc4 {+0.40/4 1.2}
24. Nxc7+ {+0.67/3 1.6} Kxc7 {-2.73/3 1.2} 25. Re3 {+2.18/2 1.6} Nb4
{-0.49/2 1.8} 26. Gxb4 {+0.74/2 0.8} Rxb4 {+2.02/4 3} 27. G@c3
{-2.29/3 1.6} G@b3 {+5.49/5 2.7} 28. Kc1 {-5.59/5 1.6} Gxc3 {+15.15/5 9}
29. N@c2 {-15.90/4 9} Rb3+ {+15.90/3 0.5} 30. Gd2 {-18.52/5 0.8} G@b1
{+21.15/5 1.4} 31. Kd1 {-18.52/2} N@d5 {+21.15/5 0.8} 32. Re2
{-21.15/4 0.9} Nxe5 {+21.15/3 0.4} 33. exe5 {-22.44/5 0.8} Gxd2
{+22.14/5 0.9} 34. Nxd2 {-20.36/5 0.9} G@c1 {+20.65/5 0.6} 35. Ke1
{-20.26/2} Bd7 {+20.06/5 1.3} 36. N@e7 {-18.05/5 0.7} Be8 {+16.24/5 0.9}
37. e5e6=+ {-13.58/5 1.5} Nxe6 {+16.88/4 0.8} 38. Rxe6+ {-16.50/4 1.0} B@g3
{+14.99/4 0.8} 39. N@f2 {-14.64/4 2.6} P@e2 {+14.03/4 0.9} 40. Bxe2
{-13.11/3 0.7} B3e5+ {+10.79/3 0.8} 41. G@d7 {-7.99/5 0.8} Kb8
{+10.11/6 2.7} 42. +Rxe5 {-10.11/6 0.9} Bxe5 {+9.81/6 1.5} 43. B@c7
{-8.96/5 2.3} Ka8 {+8.66/5 1.5} 44. Gxe8 {-8.96/5 1.5} R@g1 {+8.96/4 1.1}
45. P@f1 {-8.96/3 0.8} g4g3=+ {+9.65/4 0.8} 46. Nxf5 {-9.18/4 1.1} +Pxf2
{+12.85/5 0.8} 47. Kxf2 {-9.18/2} Rg3+ {+12.75/5 1.6} 48. Ke1 {-9.18/2}
+Re3 {+12.39/4 1.2} 49. Nxe5 {-7.64/4 1.7} N@f3# {+159.99/2}
{Black mates} 0-1
The suspect thing is that it does not see mated-in-1 coming in a 4-ply search. The thinking output was:
Code: Select all
dep score nodes time (not shown: tbhits knps seldep)
4 -7.64 442371 0:01.68 49. Nxe5 +xe5 50. Nd7+
3 -1.26 7857 0:00.06 49. Nxe5 +xe5 50. Nd7+
2 -1.26 518 0:00.00 49. Nxe5 +xe5 50. Nd7+
dep score nodes time (not shown: tbhits knps seldep)
2 +159.99 3082 0:00.02 49. ... N@f3
This sort of reproduces in a virgin search in the position where it fails to detect the mated-in-1. Strange thing is that it does switch to Pf2 to defend against the mate already at 3 ply in its PV,
but it does not play it! It still played Nxe5?
Code: Select all
dep score nodes time (not shown: tbhits knps seldep)
3 -14.18 458770 0:01.64 49. Pf2 Bh2+ 50. Pd4
2 -1.26 452 0:00.00 49. Nxe5 +xe5 50. Nd7+
This was at 40 moves/min; when I gave it more time (40/10', again in a virgin search) it does switch to Pf2 and actually plays it:
Code: Select all
dep score nodes time (not shown: tbhits knps seldep)
4 -26.02 3.11M 0:11.48 49. Pf2 Bc3+ 50. Bf1 +xd2
3 -1.26 7119 0:00.07 49. Nxe5 +xe5 50. Nd7+
2 -1.26 514 0:00.00 49. Nxe5 +xe5 50. Nd7+
Is this a "play the best move of the previous iteration when the score drops too much" trick in combination with some search explosion on check extensions? (4 ply in 11 sec is a bit meagre...)
Also note there is a cosmetic problem in the PV notation: +xe5 probably means +Rxe5 here.
Some other remarks:
* The Judkins example now does contain a Rule: repeat4 = draw, but it doesn't mention anything about perpetuals yet. Is this an omission or still awaiting implementation?
* Is it possible to indicate promotion is mandatory? In Euro-Shogi it is. In regular Shogi it only is when the piece would have no moves. Or, in line with the notation in Chess where you say for Pawn "NBRQ", shouldn't Shogi promotions be denoted as "+=" when they are optional, and "+" when they are mandatory?
* It sees the mandatory P and N promotions are now implied even when there is a possibility to defer (which currently also seems implied). This could stay that way. Or it could be made explicit by defining rank7, 8 and 9 as separate zones, and for Pawn specify "+=" for promotion in rank7 and 8, and only "+" on rank9. Does Sjaak already allow such position-dependent promotion options in general, or can you have only one promotion rule per piece?
* It seems that in Dobutsu Shogi it is allowed to drop a Pawn on the last rank, turning it into dead wood. I suppose Sjaak uses the heuristic that you cannot drop where you have no moves. Could this also be made configurable? (Wish-list item!)