Chess variant tournament: Shatranj

Discussion of computer chess matches and engine tournaments.

Moderators: hgm, Rebel, chrisw

enhorning
Posts: 342
Joined: Wed Jan 05, 2011 10:05 pm

Chess variant tournament: Shatranj

Post by enhorning »

Hoping to start it at some point during this coming week.

1-cpu (on an i-970), 512 MB Hash / program, no ponder, 40 moves in 20 minutes. As usual, it will be multiple cycles after different first moves.

Running a blitz test tournament, I got this grid:

Code: Select all

Cross table, sorted by score percentage, Buchholz, SB

                              Ti Ne Sh Pu Da Sj
 1. Tiyaga v1.0               ## 1= 11 11 11 11   95%   9.5 ( 41.0,  37.0)
 2. NebiyuChess_1.43          0= ## 1= 11 11 11   80%   8.0 ( 44.0,  26.8)
 3. ShaMax 4.8O               00 0= ## 1= 11 11   60%   6.0 ( 48.0,  15.3)
 4. Pulsar2009-9b             00 00 0= ## == 11   35%   3.5 ( 53.0,   7.0)
 5. Dabbaba 6.52 JA by Jens Bæk Nielsen 00 00 00 == ## 10   20%   2.0 ( 56.0,   4.5)
 6. Sjaak 519                 00 00 00 00 01 ##   10%   1.0 ( 58.0,   2.0)
Sjaak's poor performance is due to the fact that it forfeited any time a promotion happened, as it can't cope with them.

If anybody knows of other WB-compatible engines (or if there are newer version of these engines), please let me know.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Chess variant tournament: Shatranj

Post by Evert »

Oops, I completely forgot! I'll send you a version with a work-around in a few hours.
User avatar
hgm
Posts: 27812
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

The new WinBoard 4.7.0 also contains a new version of ShaMax (4.8S). I don't expect the differences to be very importantn for a Shatranj tourney, but at least it should now use its entire hash table, in stead of only the even entries.

I still did not get to making a separate Fairy-Max package and announce this new version. At the moment I am a bit busy with CCT.

I might be able to make my incipient engine HaChu, designed for large Shogi variants, play Shatranj. None of the Shatranj pieces has moves that could not occur in a large Shogi variant. (The Alfil move occurs on the Phoenix.) In fact I already put in a setup for normal Chess, but it cannot really play it, because it is still lacking castling, double-pushes and e.p., none of which of course occur in Shogi. But Shatranj is also free of these. And also free of promotion choice. The only weirdness in Shatranj is the divergent move of the Pawn, and that I put in the move generator already.

It will probably play like cr*p, as at the moment it still has fixed-depth search plus at most two ply of capture search. And it would not know the baring rule. But the latter did not prove that much of a handicap.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Chess variant tournament: Shatranj

Post by Evert »

And it would not know the baring rule. But the latter did not prove that much of a handicap.
I don't think it comes up very often. I implemented it in Sjaak by awarding a positive mate score when the opponent has a bare king. The situation of two bare kings is ruled a draw first.

At least, that's what it's supposed to do. The actual implementation, if I recall correctly, is a good deal messier.
User avatar
hgm
Posts: 27812
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

The trick to make this easy was that you have to judge before your own move if the opponent is bare, not after (where he might still be able to capture your last piece to draw, if you had only one). So for the WinBoard implementation I reformulated the baring rule as:

Code: Select all

When at the start of your move the opponent has bare King, the game is finished.
If you have a bare King as well, it finishes as draw.
Otherwise you win.
Beware, though, that this has consequences for the engines: they must postpone their win claim to the start of their own move, or WinBoard would consider it an illegal claim. So when you capture the last piece of the opponent, you cannot yet claim a win, not even if the opponent has no possibility to bare you back (e.g. because you have more than one non-royal piece, or the one you have is out of his reach). This is considered a situation similar to drawing by perpetual check in Chess, where you have to wait until his evasion actually creates the repeat, even through he has only a single legal evasion that will do that.

In the test match between Fairy-Max and Pulsar I once broadcasted the main case where not knowing the baring rule would hurt was that the weak side throws away the game by offering Rook exchange in KRPKR or KRFKR, or that it fails to profit from such an offer by declining to trade. It did happen, but was not extremely frequent. (E.g. quite unlike Xiangqi when you would not know the perpetual checking rule, which is an almost guaranteed loss.)
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Chess variant tournament: Shatranj

Post by Evert »

hgm wrote:The trick to make this easy was that you have to judge before your own move if the opponent is bare, not after (where he might still be able to capture your last piece to draw, if you had only one). So for the WinBoard implementation I reformulated the baring rule as:

Code: Select all

When at the start of your move the opponent has bare King, the game is finished.
If you have a bare King as well, it finishes as draw.
Otherwise you win.
Indeed, that is essentially what Sjaak does as well. As you say, the downside is that the win is detected one ply too late, but at least you see the win (and draw).
Sjaak shouldn't make a claim subsequent to its own move, only when given a position to search where it failed to find a move (because the game had already ended). I actually count on not being given such a position normally.
(E.g. quite unlike Xiangqi when you would not know the perpetual checking rule, which is an almost guaranteed loss.)
Indeed. However, it also hurts if you disallow every repetition (but that's the best I can do realistically in Sjaak, although I could be a bit more restrictive and only disallow it if the repetition is the only way to avoid a SEE>0 capture). Naturally I don't make any claims about the end of the game based on repetitions in XiangQi (or it could forfeit the game very easily with an illegal claim).
enhorning
Posts: 342
Joined: Wed Jan 05, 2011 10:05 pm

Re: Chess variant tournament: Shatranj

Post by enhorning »

hgm wrote:Beware, though, that this has consequences for the engines: they must postpone their win claim to the start of their own move, or WinBoard would consider it an illegal claim.
Ah, that explains this oddness then:
[Event "Computer Chess Game"]
[Site "ENHORNING"]
[Date "2013.02.24"]
[Round "7"]
[White "Pulsar2009-9b"]
[Black "Dabbaba 6.52 JA by Jens Bæk Nielsen"]
[Result "1/2-1/2"]
[TimeControl "40/120"]
[Variant "shatranj"]
[Annotator "1. +0.02 1... -0.03"]

1. Bh3 {+0.02/4} d6 {-0.03/9 5} 2. Nf3 {-0.09/8 2.9} Nf6 {+0.15/8 1.9} 3.
Nc3 {-0.11/8 2.9} d5 {+0.19/7 1.5} 4. d3 {-0.08/7 2.9} Bd6 {+0.02/7 2.7} 5.
e3 {-0.04/7 2.9} Nc6 {-0.12/7 2.6} 6. a3 {-0.06/7 2.9} e6 {+0.13/7 2.7} 7.
e4 {-0.06/7 2.9} d4 {+0.13/6 1.0} 8. Ne2 {+0.42/8 2.9} e5 {+0.03/7 2.4} 9.
c3 {+0.41/7 2.9} dxc3 {+0.28/7 1.9} 10. bxc3 {+0.40/7 2.9} Be6
{+0.35/6 1.0} 11. Rb1 {+0.47/7 2.9} Kc8 {-0.13/7 7} 12. a4 {+0.46/7 2.9} b6
{+0.33/6 1.8} 13. Kc2 {+0.45/7 2.9} h6 {+0.36/5 1.0} 14. d4 {+0.54/7 2.9}
Nxe4 {+0.79/6 3} 15. Kd3 {+0.48/7 2.9} exd4 {+1.82/7 4} 16. Kxe4
{+1.79/7 2.9} Bg4 {+1.22/6 1.1} 17. Nexd4 {+3.03/7 2.9} Qd7 {-4.72/6 1.7}
18. Nxc6 {+4.33/7 2.9} Qxc6 {-4.58/7 4} 19. Ne5 {+4.32/7 2.9} Re8
{-4.25/5 2.2} 20. Kd4 {+4.33/8 2.9} Qd7 {-4.43/5 3} 21. Nxg4 {+4.35/7 2.9}
Bf8 {-2.85/6 2.3} 22. Ba3 {+4.45/7 2.9} Bd6 {-5.37/5 2.0} 23. g3
{+4.50/7 2.9} Bf8 {-4.28/5 2.4} 24. Qd2 {+4.52/7 2.9} Re6 {-5.23/6 4} 25.
f3 {+4.53/7 2.9} a6 {-5.51/6 5} 26. Nf2 {+4.54/7 2.9} b5 {-5.79/6 3} 27.
Ne4 {+4.57/7 2.9} bxa4 {-5.16/6 2.8} 28. Rb4 {+4.82/7 2.9} Bd6 {-3.10/7 3}
29. Rxa4 {+4.91/7 2.9} Bf4 {-3.82/7 2.8} 30. gxf4 {+6.39/7 2.9} a5
{-6.73/6 2.1} 31. Rb1 {+6.42/7 2.9} Qc6 {-6.72/6 3} 32. f5 {+6.45/7 2.9}
Re8 {-7.12/7 2.2} 33. c4 {+6.44/7 2.9} f6 {-7.41/7 4} 34. Bc5 {+7.18/7 2.9}
Rg8 {-7.91/7 5} 35. Rba1 {+7.21/7 2.9} Rd8+ {-8.02/7 1.9} 36. Ke3
{+7.21/8 2.9} Rb8 {-8.55/7 2.0} 37. Rxa5 {+7.24/7 2.9} Rb3+ {-9.18/7 9} 38.
Qc3 {+7.25/8 2.9} Qb7 {-9.30/7 6} 39. Rb5 {+7.26/7 2.9} Rxb5 {-9.39/7 1.3}
40. cxb5 {+7.25/8 2.9} h5 {-9.35/5 0.7} 41. Rg1 {+7.85/7 2.9} Rd7
{-9.78/7 2.1} 42. Ng3 {+7.60/7 2.9} Rd5 {-10.21/7 1.3} 43. Qd4
{+7.61/8 2.9} Rd8 {-10.38/7 2.7} 44. Ne4 {+7.93/8 2.9} Rd7 {-9.72/7 2.6}
45. Rg6 {+7.81/7 2.9} Rf7 {-9.70/7 4} 46. Ng3 {+8.21/7 2.9} h4
{-11.03/8 1.6} 47. Nh5 {+8.21/8 2.9} c6 {-11.06/8 5} 48. bxc6 {+9.32/8 2.9}
Qxc6 {-10.61/8 2.0} 49. Rxg7 {+9.35/8 2.9} Rxg7 {-13.43/8 3} 50. Nxg7
{+9.42/9 3} Kb7 {-13.78/10 2.8} 51. Ne8 {+10.02/9 2.9} Ka6 {-14.13/9 3} 52.
Nxf6 {+10.10/9 2.9} Kb5 {-14.12/7 0.9} 53. Ng4 {+10.16/9 2.9} Kc4
{-14.36/7 1.8} 54. f6 {+10.28/9 2.9} Kb3 {-14.79/8 4} 55. Ne5
{+10.99/9 2.9} Qd5 {-15.68/7 6} 56. f7 {+10.99/9 2.9} Kb2 {-15.32/8 6} 57.
f8=Q {+11.09/9 2.9} Kb3 {-16.85/8 1.1} 58. Qe7 {+11.12/8 2.9} Kb2
{-16.85/7 1.2} 59. Qf6 {+11.15/8 2.9} Kb3 {-17.50/8 1.1} 60. Qg5
{+11.18/8 2.9} Kb4 {-17.77/9 4} 61. f4 {+11.18/8 2.9} Qc4 {-18.27/9 5} 62.
Nxc4 {+149.98/8 2.9} Kxc4 {-15.22/8 1.0} 63. Qxh4 {+149.99/9 2.9}
{False win claim: '' but bare king} 1/2-1/2

... easy enough to correct the rare wrong results of such games manually, given that I think it is only Pulsar that claims the win early.
Last edited by enhorning on Sun Feb 24, 2013 11:12 am, edited 1 time in total.
enhorning
Posts: 342
Joined: Wed Jan 05, 2011 10:05 pm

Re: Chess variant tournament: Shatranj

Post by enhorning »

Evert wrote:Oops, I completely forgot! I'll send you a version with a work-around in a few hours.
523 still seems to not work :(

[Event "Computer Chess Game"]
[Site "ENHORNING"]
[Date "2013.02.24"]
[Round "2"]
[White "Sjaak 523"]
[Black "NebiyuChess_1.43"]
[Result "0-1"]
[TimeControl "40/120"]
[Variant "shatranj"]
[Annotator "1. +0.01 1... -0.15"]

1. Nc3 {+0.01/14} Bd6 {-0.15/20 2.8} 2. Bd3 {+0.02/14 3} Be6 {-0.05/20 2.8}
3. Be3 {+0.06/13 1.5} Nc6 {-0.05/21 2.2} 4. Nh3 {+0.04/13 3} Nf6
{+0.05/17 2.2} 5. f3 {+0.13/11 1.5} Rc8 {+0.00/16 2.3} 6. f4 {+0.12/12 1.8}
g6 {+0.05/16 2.9} 7. Qf2 {+0.11/11 1.7} Rg8 {+0.10/16 2.4} 8. b3
{+0.13/11 1.9} Rg7 {+0.10/17 2.8} 9. Re1 {+0.16/11 1.8} Nd4 {+0.10/17 2.4}
10. Qg3 {+0.12/11 1.7} h6 {+0.05/16 3} 11. Rb1 {+0.19/12 3} Bg4
{+0.10/15 2.6} 12. Rb2 {+0.21/11 2.1} c6 {+0.00/15 3} 13. Bc5 {+0.30/11 4}
Ne6 {+0.05/17 2.7} 14. b4 {+0.30/11 3} a6 {+0.15/14 2.7} 15. a3
{+0.30/10 2.3} a5 {+0.30/16 2.9} 16. Rh1 {+0.16/9 2.4} Nd5 {+0.45/14 2.3}
17. Nxd5 {+0.22/10 3} cxd5 {+0.40/13 0.6} 18. c3 {-0.02/10 4} b6
{+0.45/15 3} 19. Be3 {-0.07/10 2.0} d4 {+0.60/16 2.9} 20. bxa5
{+0.01/9 2.1} bxa5 {+0.55/16 3} 21. cxd4 {+0.11/11 2.1} Nxd4 {+0.50/18 2.4}
22. Ng1 {+0.00/12 2.7} Rc4 {+0.55/18 2.4} 23. Nf3 {+0.08/12 2.6} Nxe2
{+0.35/19 4} 24. Ne5 {+0.19/12 5} Ra4 {+0.35/19 3} 25. Nxg4 {+0.34/11 2.1}
Nd4 {+0.50/19 3} 26. Nxh6 {+0.35/11 1.9} Rxa3 {+0.55/19 3} 27. Bb1
{+0.29/11 4} Ra1 {+0.50/18 3} 28. Ng4 {+0.42/11 4} a4 {+0.60/20 3} 29. Kc1
{-0.03/10 2.0} a3 {+1.50/18 2.8} 30. Rb7 {+0.00/12 2.9} Ra2 {+0.90/18 3}
31. Kd1 {+0.00/12 2.6} Kc8 {+2.00/22 2.7} 32. Rb6 {-0.31/11 2.5} Kc7
{+2.20/22 2.9} 33. Ra6 {-1.64/12 3} Bb4 {+2.20/20 4} 34. Rg1 {-1.64/12 4}
Rxd2+ {+2.25/20 4} 35. Ke1 {-1.64/11 2.5} a2 {+2.30/19 4} 36. Ra8
{-1.69/11 5} f6 {+2.90/19 3} 37. Bc5 {-1.54/10 2.9} g5 {+2.85/17 3} 38. f5
{-1.49/9 4} axb1=Q {+2.70/18 3}
{False illegal-move claim} 0-1

and

[Event "Computer Chess Game"]
[Site "ENHORNING"]
[Date "2013.02.24"]
[Round "4"]
[White "Sjaak 523"]
[Black "Pulsar2009-9b"]
[Result "0-1"]
[TimeControl "40/120"]
[Variant "shatranj"]
[Annotator "1. +0.06 2... -0.01"]

1. Be3 {+0.06/13} Nc6 2. Bd3 {+0.03/13 2.4} Nf6 {-0.01/8 2.9} 3. Nc3
{+0.02/12 4} e6 {-0.01/7 2.9} 4. Nh3 {+0.12/12 1.8} d6 {+0.01/7 2.9} 5. f3
{+0.11/11 2.7} h6 {+0.03/7 2.9} 6. Qf2 {+0.21/11 2.3} a6 {+0.06/7 2.9} 7.
g3 {+0.26/10 2.5} a5 {+0.10/7 2.9} 8. g4 {+0.26/10 2.2} a4 {+0.13/7 2.9} 9.
Rc1 {+0.31/10 4} d5 {+0.18/7 2.9} 10. Nb5 {+0.23/10 2.0} Ne5 {+0.17/6 2.9}
11. Re1 {+0.21/8 2.4} Nc4 {+0.24/6 2.9} 12. Rb1 {+0.17/11 4} c6
{+0.27/7 2.9} 13. Na3 {+0.17/10 3} Nxa3 {+0.43/7 2.9} 14. bxa3 {+0.16/12 4}
Kc7 {+0.45/7 2.9} 15. Rb2 {+0.25/10 1.8} b6 {+0.51/7 2.9} 16. Qg3
{+0.25/11 2.7} c5 {+0.49/7 2.9} 17. c3 {+0.23/10 3} e5 {+0.49/7 2.9} 18.
Nf2 {+0.20/8 1.9} Be6 {+0.52/7 2.9} 19. Kc2 {+0.10/9 4} g6 {+0.51/7 2.9}
20. Reb1 {+0.22/10 4} Ra6 {+0.50/7 2.9} 21. Bb5 {+0.16/9 3} Bc4
{+0.51/7 2.9} 22. Kd1 {+0.17/9 2.4} Ra8 {+0.45/7 2.9} 23. Nd3 {+0.36/9 2.4}
Kd6 {+0.55/7 2.9} 24. Ra1 {+0.26/9 4} Rg8 {+0.56/7 2.9} 25. h3
{+0.20/9 2.8} g5 {+0.56/7 2.9} 26. Rab1 {+0.23/10 2.6} Bxe2 {+0.57/7 2.9}
27. Kxe2 {+0.70/9 1.8} h5 {+0.56/7 2.9} 28. Nf2 {+0.87/9 1.8} Kc6
{+0.52/7 2.9} 29. Bd3 {+0.68/10 2.9} Ra6 {+0.46/7 2.9} 30. Bf5 {+0.63/10 3}
Rg7 {+0.14/7 2.9} 31. Bxc5 {+0.88/9 2.6} hxg4 {+0.70/7 2.9} 32. hxg4
{+0.80/10 2.7} bxc5 {+0.45/8 2.9} 33. Rb5 {+0.88/10 3} c4 {+0.38/7 2.9} 34.
Rb8 {+1.01/10 3} Rg6 {+0.83/7 2.9} 35. d3 {+1.15/11 4} cxd3+ {+0.80/8 2.9}
36. Nxd3 {+1.02/10 6} Kd6 {+0.49/7 2.9} 37. R1b7 {+1.21/9 2.8} Rc6
{+0.83/7 2.9} 38. Nb4 {+1.17/9 1.9} Rc5 {+0.30/7 2.9} 39. Rb6+ {+1.24/9 4}
Ke7 {-0.84/8 2.9} 40. R8b7+ {+1.24/9 2.9} Kd8 {-0.84/8 2.9} 41. Nc6+
{+2.79/11 3} Rxc6 {-1.67/9 2.9} 42. Rxc6 {+2.79/13 2.2} e4 {-1.67/8 2.9}
43. Ra6 {+2.61/12 4} Kc8 {-2.65/8 2.9} 44. Re7 {+2.62/11 4} Kd8
{-2.65/9 2.9} 45. Rea7 {+2.62/11 2.2} Rh6 {-2.07/8 2.9} 46. Rxa4
{+2.59/10 3} Rh1 {-2.05/8 2.9} 47. R4a6 {+3.28/10 2.1} Rh6 {-2.14/8 2.9}
48. Rb7 {+3.55/11 3} Kc8 {-2.98/9 2.9} 49. Rbb6 {+3.06/12 4} exf3+
{-3.52/9 2.9} 50. Kxf3 {+3.56/12 2.3} Ne4 {-3.52/9 2.9} 51. Rxh6
{+3.75/12 2.7} Bxh6 {-3.43/9 2.9} 52. Ra8+ {+3.75/14 1.7} Kc7 {-3.98/9 2.9}
53. Rxe8 {+3.75/14 3} Nxc3 {-3.99/9 2.9} 54. Re7+ {+3.96/13 3} Kd6
{-4.03/9 2.9} 55. Rxf7 {+3.94/13 2.0} Ne4 {-4.05/9 2.9} 56. a4 {+3.96/12 4}
Ke5 {-4.02/9 2.9} 57. Re7+ {+3.95/11 2.3} Kd4 {-4.03/9 2.9} 58. Rb7
{+3.95/11 2.2} Nd2+ {-3.99/9 2.9} 59. Kg2 {+4.02/12 2.3} Ne4 {-3.99/8 2.9}
60. Qf2 {+4.01/12 1.9} Nc5 {-3.98/9 2.9} 61. Rb1 {+4.13/12 2.2} Ke5
{-3.99/8 2.9} 62. a5 {+4.08/12 2.5} Ne4 {-4.02/8 2.9} 63. Qg3 {+4.09/12 3}
Bf8 {-4.04/8 2.9} 64. a6 {+4.45/14 1.9} Nc3 {-4.47/8 2.9} 65. Rb2
{+4.45/15 2.9} Na4 {-4.74/9 2.9} 66. Re2+ {+4.45/14 5} Kd6 {-5.18/9 2.9}
67. Re8 {+5.01/14 3} Bh6 {-5.26/8 2.9} 68. Rg8 {+4.55/13 4} Ke7
{-5.26/9 2.9} 69. Rxg5 {+5.21/14 2.5} Kf6 {-5.67/9 2.9} 70. Rh5
{+5.25/14 4} Bf8 {-5.36/9 2.9} 71. a7 {+5.25/14 4} Nb6 {-5.49/8 2.9} 72.
Qf2 {+5.25/13 4} Ke6 {-5.46/8 2.9} 73. Rh7 {+5.39/14 5} Na8 {-6.36/8 2.9}
74. Rd7 {+5.39/13 4} Bd6 {-6.38/9 2.9} 75. Rd8 {+5.98/14 3} Nb6
{-6.39/9 2.9}
{Xboard: Forfeit due to invalid move: a7a8f (a1a1) res=24} 0-1
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Chess variant tournament: Shatranj

Post by Evert »

enhorning wrote: 523 still seems to not work :(
Oh, duh. :oops:

I thought it was good enough to tell Sjaak that a Ferz, abbreviated F, is called "Q" or "q" for black and white. It's not though, because it derives the promotion piece from the symbol it uses to print SAN moves, which is still set to "F".
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Chess variant tournament: Shatranj

Post by Evert »

Ok, uploading rev. 524 to replace 523 now.