Chess variant tournament: Shatranj

Discussion of computer chess matches and engine tournaments.

Moderator: Ras

User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

If the engines knew the counting rule, I guess it would really give rise to some interesting end-games. But I am afraid it is way beyond the capabilities of Fairy-Max to implement such a thing.

I guess HaChu should be able to play Makruk. Also no castling and e.p. capture there, and extended promotion zones is just what it is used to!
Ferdy
Posts: 4851
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Chess variant tournament: Shatranj

Post by Ferdy »

After that, I will most likely return to another variant with low-powered promotion for the following tournament - Makruk or Thai chess. As my understanding is that Winboard does not support the endgame counting rule, the tournament will not use these, to save me from having to manually score games (which I had to do a fair bit in this tournament, as a couple of the programs claimed the win immediately after baring the enemy King, which WB rejects as false).
I hope the Makruk variant tourney will get done, I will create one to participate. The rules below (taken from makruk wiki) will be my reference. Perhaps will make this user configurable to use counting rules or not.

Code: Select all

In starting position, pawns are placed on the third and sixth ranks. Queens are placed at the right side of kings. Pawns promote (เบี้ยหงาย bia ngai, flipped cowry shell) and move like queens when they reach the sixth rank. There is no castling rule like that of international chess.

Counting rules
* When neither side has any pawns, the game must be completed within a certain number of moves or it is declared a draw. 
When a piece is captured the count starts again from scratch only if it is the last piece of one side in the game.
When neither side has any pawns left, mate must be achieved in 64 moves. The disadvantaged player does the counting, and may at any time choose to stop counting. If the disadvantaged side checkmates the advantage side and did not stop counting, the game is declared a draw.

When the last piece (that is not the king) of the disadvantaged side is captured, the count may be started, or restarted from the aforementioned counting, by the weaker side, and the stronger side now has a maximum number of moves based on the pieces left:
* If there are two rooks left: 8 moves
* If there is one rook left: 16 moves
* If there are no rooks left, but there are two bishops: 22 moves
* If there are no rooks left, but there is one bishop: 44 moves
* If there are no rooks or bishops left, but there are two knights: 32 moves
* If there are no rooks or bishops left, but there is one knight: 64 moves
* If there are no rooks, bishops, or knights, but queens: 64 moves

The weaker side pronounces aloud the counting of his fleeing moves, starting from the number of pieces left on the board, including both kings. The stronger side has to checkmate his opponent's king before the maximum number is pronounced, otherwise the game is drawn. During this process, the count may restart if the counting side would like to stop and start counting again.
For example, if White has two rooks and a knight against a lone black king, he has three moves to checkmate his opponent (the given value of 8 minus the total number of pieces, 5). If Black captures a white rook, the count does not automatically restart, unless Black is willing to do so, at his own disadvantage. However, many players do not understand this and restart the counting while fleeing the king.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

This is totally ambiguous. As the count seems to count up, it is not clear whether the draw is achieved when it reaches the number belonging to the material at that moment, or the material when you started counting. So in the example of KRRNK, which presumably is reached because white just captured something: it is black's move, and he calls '5'. White does his first move, '6', white's second move, '7', white's third move, '8=draw'. So far, so good; white has indeed 3 moves to perform check-mate, he must deliver it with his third move at the latest.

But now suppose on my first move I force him to capture one of my Rooks (while he called '6'). Would it still be draw when he reaches '8'? Or would he now have to continue counting all the way up to '16', before he can claim draw?

The latter rule seems cleaner, as the former seems to require an extra game-state variable. You would have to count '5/8', '6/8', '7/8', '8/8=draw', as it were. It would be more logical to count (8-5 =) '3', '2', '1', '0=draw' in that case. But that is not how they count.

As to a poor-man's solution for having engines play by these rules: just bias it against baring the opponent's King. If you are winning this badly (R+R+N ahead) it seems really stupid to get involved in all this stuff by taking his last Pawn.

I could patch Pair-o-Max to function well under these rules. It has the infra-structure to see how many Pawns each side has. Currently it divides the score of the leading side by 2 if that side has no Pawns, except when the losing side is bare. It would be trivial to change that to dividing by an even larger factor when the opponent is bare, and dividing by 2 when there is just one Pawn of the two of you combined. (Unlike in Chess Pawns don't automatically provide mating potential, so how many you have yourself is not really a crucial factor.) That way the engine would rather block the opponent's last Pawn than take it, especially if he is a lot ahead. Then it would never get to a position where the count would become important.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

This is a strange game by Sjaak, which almost certainly points to a bug:

Code: Select all

[Event "Computer Chess Game"]
[Site "ENHORNING"]
[Date "2013.03.04"]
[Round "24"]
[White "Sjaak 524"]
[Black "ShaMax 4.8S"]
[Result "0-1"]
[TimeControl "40/1200"]
[Variant "shatranj"]
[FEN "rnbkqbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBKQBNR w 0 1"]
[SetUp "1"]

{--------------
r n b k q b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B K Q B N R
white to play
--------------}
1. Bd3 e6 {+0.13/12 24} 2. Be3 {+0.11/16 18} Bd6 {+0.15/12 23} 3. Nh3
{+0.11/16 16} Nh6 {+0.09/12 16} 4. f3 {+0.05/15 16} Nc6 {+0.09/14 30} 5.
Nc3 {+0.06/17 32} f6 {+0.09/14 40} 6. Rg1 {+0.01/14 32} a6 {+0.00/12 17} 7.
g3 {+0.09/15 21} b6 {+0.03/12 25} 8. g4 {+0.11/14 17} Qf7 {+0.07/11 16} 9.
a3 {+0.08/13 18} e5 {+0.03/12 16} 10. g5 {+0.03/14 35} Ng8 {+0.03/12 17}
11. gxf6 {+0.18/13 29} Nxf6 {+0.07/12 22} 12. Ng5 {+0.11/14 30} Qg6
{+0.01/14 26} 13. Nge4 {+0.10/16 33} Bf4 {+0.02/13 20} 14. Nxf6
{+0.07/15 37} gxf6 {+0.06/14 28} 15. Rg2 {+0.10/15 31} Ne7 {+0.05/13 31}
16. Ne4 {+0.03/14 29} Rf8 {+0.00/13 23} 17. Qf2 {+0.00/14 27} d6
{+0.07/12 18} 18. c3 {+0.08/14 36} d5 {+0.36/14 18} 19. Ng3 {+0.13/15 34}
Bxd2 {+0.17/15 35} 20. Kxd2 {+0.47/16 34} h6 {+0.09/14 25} 21. Rag1
{+0.65/13 29} f5 {+0.12/14 23} 22. Nf1 {+0.78/14 18} Rf6 {+0.04/14 24} 23.
Kd1 {+0.73/15 35} Be6 {+0.01/13 35} 24. Nd2 {+0.81/15 19} f4 {+0.05/13 22}
25. Bc1 {+0.76/15 30} c6 {+0.16/13 26} 26. b3 {+0.89/14 29} b5
{+0.17/12 23} 27. a4 {+0.85/14 32} bxa4 {+0.00/13 26} 28. bxa4
{+0.77/15 41} c5 {+0.04/14 41} 29. Ba3 {+0.86/16 31} Rc8 {+0.10/15 29} 30.
Kc2 {+0.74/15 38} c4 {+0.03/13 28} 31. Bf1 {+0.52/14 27} Qf7 {+0.24/13 32}
32. Rg7 {+0.63/14 24} Qg6 {+0.52/13 17} 33. e3 {+0.88/14 51} fxe3
{+0.40/13 27} 34. Qxe3 {+0.84/15 42} Ke8 {+0.50/13 27} 35. f4 {+0.80/15 23}
exf4 {+0.79/15 36} 36. Qxf4 {+0.84/15 42} Bg8 {+0.83/15 26} 37. Qe5
{+0.90/14 28} Rb6 {+1.05/14 25} 38. Nf3 {+0.52/15 23} Kf8 {+0.53/14 32} 39.
Rxe7 {+0.76/15 30} Kxe7 {+1.25/15 51} 40. a5 {+0.51/16 1:05} Re6
{+1.34/15 26} 41. Bh3 {+0.87/13 22} Qh5 {+1.45/14 20} 42. Kd1 {-1.00/13 26}
Rg6 {+1.62/15 27} 43. Rxg6 {-1.09/14 16} Qxg6 {+1.73/16 26} 44. Qd4
{-1.13/15 20} Ke6 {+1.73/16 21} 45. Nh4 {-1.22/16 44} Kf7 {+1.64/16 19} 46.
Qc5 {-1.22/16 13} Be6 {+1.72/16 30} 47. Ng2 {-1.08/17 21} Rb8 {+1.58/15 20}
48. Qb6 {-1.17/17 51} Kf6 {+1.51/16 24} 49. Ke1 {-1.14/14 21} Ke5
{+1.53/17 26} 50. Nh4 {-1.16/16 29} Rg8 {+1.54/17 22} 51. Ng2 {-1.27/15 26}
Qf5 {+1.54/18 37} 52. Ne3 {-1.28/18 27} Qe4 {+1.55/19 38} 53. Bf1
{-1.29/18 32} Rf8 {+1.51/18 20} 54. Qc5 {-1.27/18 32} Kf4 {+1.63/15 20} 55.
Kf2 {-1.27/18 32} h5 {+1.67/17 27} 56. Nc2 {-1.15/15 25} Ke5+ {+1.57/16 47}
57. Kg1 {-1.15/16 33} Rg8+ {+1.54/16 18} 58. Kf2 {-1.13/17 32} Rb8
{+1.59/15 22} 59. Nb4 {-1.11/17 24} Kf6 {+1.56/16 23} 60. Qb6 {-1.12/16 27}
Rf8 {+1.54/17 50} 61. Kg2 {-1.11/16 21} Ra8 {+1.50/16 21} 62. Bc5
{-1.10/17 20} Rg8+ {+1.61/17 45} 63. Kf2 {-1.15/17 35} Rf8 {+1.63/18 39}
64. Kg2 {-1.09/15 19} Ke5 {+1.61/19 28} 65. Nc6+ {-1.13/17 36} Kd6
{+1.60/20 27} 66. Nd4 {-1.13/18 23} Rf6 {+1.65/18 20} 67. Bh3 {-1.12/18 19}
Ke5 {+1.69/21 29} 68. Nc6+ {-1.12/18 38} Kf4 {+1.63/21 31} 69. Nd4
{-1.12/19 32} Rg6+ {+1.67/21 26} 70. Kf2 {-1.11/18 35} Rh6 {+1.68/19 20}
71. Qc7 {-1.11/17 34} Rf6 {+1.69/20 39} 72. Bf1 {-1.11/18 22} Ke5+
{+1.69/19 26} 73. Kg1 {-1.11/17 26} Qf3 {+1.60/17 22} 74. Qd8 {-1.11/18 59}
Rg6+ {+1.62/17 23} 75. Kf2 {-1.97/18 37} Ke4 {+2.43/20 26} 76. Ke1
{-2.19/18 44} Bc8 {+2.42/19 36} 77. h3 {-2.25/18 34} Rg2 {+2.59/18 28} 78.
Qe7 {-2.25/19 56} Ra2 {+2.84/19 36} 79. Nc6 {-2.44/17 22} Rc2 {+2.81/19 34}
80. h4 {-2.54/16 50} Rxc3 {+3.59/18 21} 81. Kd2 {-2.68/16 18} Rb3
{+3.79/17 21} 82. Ke1 {-3.15/17 27} Rb7 {+3.90/19 1:00} 83. Na7
{-3.20/18 19} Be6 {+3.75/20 36} 84. Nc6 {-3.65/17 27} Rc7 {+3.78/19 29} 85.
Nd8 {-3.95/19 29} Rxc5 {+4.47/20 1:11} 86. Nxe6 {-3.95/19 17} Rxa5
{+4.63/19 23} 87. Kd2 {-3.95/19 31} Ke5 {+4.69/18 18} 88. Ng7 {-4.22/17 47}
Qg4 {+5.26/19 22} 89. Ke2 {-4.23/17 25} Rc5 {+5.37/20 22} 90. Ne8
{-4.88/18 28} Rc6 {+5.43/20 38} 91. Kd1 {-4.91/17 20} Re6 {+8.73/21 20} 92.
Qd6+ {-6.06/18 21} Kd4 {+9.73/22 25} 93. Nc7 {-7.38/20 33} Rxd6
{+10.87/23 35} 94. Ne8 {-7.85/20 17} Rc6 {+10.89/22 22} 95. Kc2
{-8.70/19 22} Ke5 {+11.81/23 24} 96. Kc3 {-9.91/18 23} Rc8 {+79.90/24 36}
97. Ng7 {-159.83/18 30} Rg8 {+79.92/25 23} 98. Ne6 {-159.85/16 1.0} Kxe6
{+79.93/28 18} 99. Kd2 {-159.87/14 0.1} Qf3 {+79.94/18 21} 100. Kc3
{-9.67/9 1:13} Rg4 {+79.95/25 21} 101. Bd3 {-165.00/3 0.1} cxd3
{+79.97/28 0.1} 102. Kb3 {-10.59/3 1:13} Rxh4 {+79.98/28 0.1}
{Black mates} 0-1
On move 41 it things it is still ahead (+0.87), and after a totally innocent reply it conceeds it is at -1.00 (which the opponent already saw for some time).

Can it think that the Elephant at h3 skewers the two Rooks?

[d]2r3b1/4k3/p3r1qp/P2pQ3/2p5/B1P2N1B/2K4P/6R1 b 2 41
After 41. Eh3
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

Game 150 also has a sharp score jump as an adjustment to reality for Sjaak on a not-so-spectacular opponent move in a rather quiet situation.

Nebiyu also behaves weird at times. How can it possibly think it is ahead in this position from game 155?

[d]8/4B3/4b3/3R4/1b1Kp3/3q4/2k5/8 w 4 146

Surely Rook must be much more valuable than F+E+P? I thought the rule of thumb was E=1, F=2, N=4, R=8.
Ferdy
Posts: 4851
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Chess variant tournament: Shatranj

Post by Ferdy »

hgm wrote:This is totally ambiguous. As the count seems to count up, it is not clear whether the draw is achieved when it reaches the number belonging to the material at that moment, or the material when you started counting. So in the example of KRRNK, which presumably is reached because white just captured something: it is black's move, and he calls '5'. White does his first move, '6', white's second move, '7', white's third move, '8=draw'. So far, so good; white has indeed 3 moves to perform check-mate, he must deliver it with his third move at the latest.

But now suppose on my first move I force him to capture one of my Rooks (while he called '6'). Would it still be draw when he reaches '8'? Or would he now have to continue counting all the way up to '16', before he can claim draw?
As long as the third move of white does not mate black then it is still a draw if black does not restart counting (human error). For engines there is no need to restart counting as it would only increase the moves to mate. For black, to be mated in 1 or 2 or 3 is better than to be mated within 16 moves. At the point where black loses all his pieces or he has only a king, say krrn-k, since there are 2 rooks, white is obliged to mate black in 8 minus total_pieces_including_king_on_the_board which is 8-5 = 3 moves.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

How do you know that? That you don't restart counting does not imply the count still has to reach the same value.

The rule about checkmates deliverd by the counting side counting as draws is also a bit vague. I suppose this only concerns situations without Pawns, as with a bare King there is not much to checkmate. For one, it is not so clear who is the disadvantaged side in this case. Can anyone who wants it start counting?

Now when exactly do you have to stop counting for a mate to be a win? It seems to me that if I see the opponent exposes himself to mate in one, I would first say "OK, I stop counting", and then checkmate him. So what is the point of this rule? Can you only start or stop counting at the end of your turn?

Btw, this source says you would have to start counting at '6' in the KRRNK case, where draw is reached at '8', so that white would really only have 2 moves to checkmate you. It also says the counting only is to be done when you have no Pawns, even if the opponent has bare King.
Ferdy
Posts: 4851
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Chess variant tournament: Shatranj

Post by Ferdy »

hgm wrote:How do you know that? That you don't restart counting does not imply the count still has to reach the same value.
hgm wrote: The rule about checkmates deliverd by the counting side counting as draws is also a bit vague. I suppose this only concerns situations without Pawns, as with a bare King there is not much to checkmate. For one, it is not so clear who is the disadvantaged side in this case. Can anyone who wants it start counting?
The counting starts when there are no pawns on both sides. It is not clear how to determine the disadvantaged side, but counting the number of pieces would be fine as a starting point at this time. If there is equal number of pieces from both sides then there is no counting or the counting should be stopped if there is one. If for example krrn-krrn white to move, and white captures the knight of black resulting in krrn-krr black to move, here the disadvantaged side is black and white should mate black in 64 moves. Along the way if black will be able to capture the knight of white resulting in krr-krr white to move, then the counting done by black should be stopped. If one side has a bare king the counting will be revised depending on the pieces remaining on the board. This can only be applied if there are no pawns on the board.
I just view like this, required_moves_to_mate = count_value_from_table - total_pieces_on_the_board. Example krrn-k, black should be mated by white within 8-5 = 3 moves. krbbnn-k, black should be mated by white within 16-7 = 9 moves. krrbbn-k, black should be mated by white within 8-7 = 1 move.
hgm wrote: Now when exactly do you have to stop counting for a mate to be a win? It seems to me that if I see the opponent exposes himself to mate in one, I would first say "OK, I stop counting", and then checkmate him. So what is the point of this rule? Can you only start or stop counting at the end of your turn?
For an engine, if the disadvantaged side mates the advantaged side then the disadvantaged side will win.
hgm wrote: Btw, this source says you would have to start counting at '6' in the KRRNK case, where draw is reached at '8', so that white would really only have 2 moves to checkmate you. It also says the counting only is to be done when you have no Pawns, even if the opponent has bare King.
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:If the engines knew the counting rule, I guess it would really give rise to some interesting end-games. But I am afraid it is way beyond the capabilities of Fairy-Max to implement such a thing.
And for Sjaak as well.
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: On move 41 it things it is still ahead (+0.87), and after a totally innocent reply it conceeds it is at -1.00 (which the opponent already saw for some time).

Can it think that the Elephant at h3 skewers the two Rooks?

[d]2r3b1/4k3/p3r1qp/P2pQ3/2p5/B1P2N1B/2K4P/6R1 b 2 41
After 41. Eh3
No. There is no diagonal slider defined for Shatranj and there is no way for rules from one variant to bleed into another.

I'll look into it; it may just be a case of search and evaluation being badly calibrated for a variant dominated by weak pieces. It's also possible that the piece values are simply dead wrong, I don't remember exactly what I put in but I almost certainly didn't try tuning it...