Closed ianfab closed 5 years ago
It might be necessary to change the order of tests in Position::counting_limit()
. The counting player will chose the minimal limit available. So the case of two knights (32 moves) should be tested before the case of one Khon (44 moves), e.g. for endgame KSNN vs K the weaker side would count from 5 to 32.
@alwey To me it also sounded strange, but on wikipedia the rule is stated as follows
If there are no rooks or bishops left, but there are two knights: 32 moves
But I guess that might simply be wrong/misleading. Unfortunately, I could not find an official document similar to the FIDE rules of chess. I mainly used the following three sources when I implemented the rules: https://en.wikipedia.org/wiki/Makruk#Counting_rules http://www.chessvariants.com/page/MPmakruk-thai-chess#rules http://ancientchess.com/page/play-makruk.htm
There are a few more things that are not fully clear to me:
I do not speak Thai, and machine translation of Thai to English is by far not good enough to be able to recognize nuances in the formulations to derive such information from rule explanations that are written in Thai, so I am relying on English sources I can find.
I learned this yesterday:
Does counting due to a bare king apply if the stronger side still has pawns? There seems to be contradictory information on that.
As soon as a king is bare, the Pieces Hounour counting begins. It overrides the Board counting.
Is there a 50/64-moves rule similar to the one in normal chess if there are still pawns on the board? I could not find any information on that, so I guess that such a rule does not exist, but engine vs. engine games without such an adjudication rule might get ridiculously long.
No, there is no general 64 moves rule. But in practice the two counting methods will limit the games. I added a threefold repetition rule to my cutechess MakrukBoard implementation. This rule does not exist in official rules of Makruk, but cutechess has to deal with engine-engine games. Some pairs of engines might continue repeating a move sequence.
Do you have to switch from the the "Board’s Honor Rule" to the "Pieces' Honor Rule" if your last piece was captured? It seems to be optional if I understand correctly.
No, it is mandatory as far as I know.
Does a material configuration also apply in counting if one piece is captured immediately, i.e., does it matter in a situation like 2R vs. 1R which side does the first capture when exchanging a pair of pieces? Since there do not seem to be any exceptions to the counting rules, I guess that is the case.
Yes, the position is evaluated immediately when
So it indeed matters which side captures first. E.g. yesterday, when Stockfish captured a Khon with one of its Rooks and Bilis took that Rook with its King, the game was soon over because Stockfish also had the other Rook and two Advisors, so the count started from 6 (KRRMM vs K) and went to 8 - a draw! The Khon did not count, it fell first.
References
Historical Chess Variants at chessvariants.org (http://www.chessvariants.com/historic.dir/HistoricalChessVariants.pdf)
- Find the move count number in this way. First ask, (1) Does the opponent have 2 rooks? If so, the number is 8. If not, go to the next question: (2) Does he have 1 rook? If so the number is 16. Continue to ask, in this order, until you get an affirmative answer: (3) 2 bishops? If so, it’s 22; (4) 2 knights? If so, it’s 32; (5) 1 bishop? If so, it’s 44; (6) any pieces at all? If so, it’s 64.
Point of clarification: The count under the Bare King - The Pieces' Honor Rule is restarted regardless of any current running count under the Pawnless Games - The Board's Honor Rule. Therefore it is possible for the new count to reach under the Bare King rule to be higher or lower, than the previous running count under the Pawnless Games rule, which is totally scratched.
@alwey Thanks, a couple of things are clearer now. I am still not entirely sure about the conditions when counting is started or restarted. The PDF you linked to adds even more confusion as it says that
If the Bare King makes any capture, a new count should immense based on the number of remaining pieces for the stronger side.
which in other sources is said to be incorrect although often used. With contradictory information from many sources it is hard to draw conclusions. The only source that I could find that is in some way official is the rules of a Makruk tournament, but that is unfortunately written in Thai. Chapter 5 is about the counting rules, but it is really hard to deduce much information from it when using google translator.
@ianfab : A new find which is consistent with the other sources except en.wikipedia.org and the PDF file:
http://www.chesslight.com/makruk.php
For example, if white has two rooks and a knight against a lone black king, he has 3 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 restart. Many players don't understand the rules and would restart.
Wow, this might be the strongest Makruk engine yet! Thanks for doing this.
Any chance of supporting Burmese Sittuyin as well? It's very closely related to Thai Makruk, but with certain different rules. Same piece types, same movements and captures, but different initial set-up, and different pawn promotion rules.
Pawns have to start from fixed squares, and the Rooks must start somewhere on the back rank, but all other pieces are free to start anywhere behind the player's own pawns. In a sense, it could probably be viewed as a Makruk"960?"
The counting rules for Sittuyin are relatively simplified. There is the 50-moves rule just like in FIDE chess. But it also observes special cases which supercede the 50-move rule. Sittuyin players will start counting when one side is left with a Lone King. Today, only 3 types of such special counting rules are observed.
So far, there has been at least one international competition hosted by the Burmese Chess Federation (perhaps unsurprisingly, Thai Makruk players did very well), so the variant does have an established set of official rules for tournament play.
The official rule book is available online for free, on Scribd and on other sites that mirror Scribd. It was personally published to Scribd by the current president of the Burmese Chess Federation, Maung Maung Lwin. Googling "How to Play Myanmar Traditional Chess by Maung Maung Lwin" would do.
Edit: Forgot to describe the promotion rules, which set it apart from Makruk enough to require considerable modifications. Promotions take place in the enemy territory, on the long diagonals. Only one Met at a time. Promotion is completely optional. No automatic "on-arrival" promotions, so the pawn must already reach the promotion square, and then spend an extra turn. To compensate this extra turn requirement partially, it can either promote on square, or move out as a Met. Promotion must not give check, or even discovered check. Also, the new Met isn't allowed to attack an enemy piece while promoting (discovered attacks by the Rook is OK, unlike the restriction of no discovered checks).
@teakado I already had a look at Sittuyin before and it would be kind of a logical follow-up, but some of the special rules make it tricky to implement, especially the setup-phase. I consider it, but probably will not have time to implement it in the next months.
Could you please move your post to a separate issue (so that the feature request does not get lost)?
Accidentally, I have had a look at Sittuyin yesterday. The set-up phase is quite different from what chess engines usually calculate. The task is much more complex than usual, because the setup can be seen as a pair of multi-leg half moves. The search tree has a much higher effective branching factor than usual. As UI developer I would probably see the game start as two 8-leg drop move sequences. Of course one could avoid these difficulties by using a setup book or start from position.
@ianfab : What I actually implemented is Ouk Chatrang (Ouk Khmer, interface: cambodian
) and ASEAN Chess (asean
) as derivatives of Makruk. All of these Makruk UI boards are now waiting for approval of ShatranjBoard
in cutechess and for the clarification / confirmation of counting rules.
@alwey Thanks for the info, that sounds great. So except for the counting rules, S-Chess, Shatranj, Makruk, Ouk, and ASEAN basically all are ready for review/merge?
How have you dealt with the special moves in Ouk? Checking whether no piece has been captured and whether the king/queen are on their original squares is strictly speaking not sufficient to know whether their special moves are allowed, since they can move and retreat, so standard FENs are not sufficient to get that information although that are extremely rare situations.
@ianfab No hurries! I went ahead and opened it as a separate issue.
For Ouk, the issues might mainly be with the GUIs. and might require modifications on the GUI side. Perhaps the FEN indicators for castling rights "KQkq" can be used somehow. In standard chess, the castling FEN flag would disappear as soon as the King has been moved.
As for the captures, maybe we could look at the piece counts, or the material count? Any less than the initial count, special flag should be removed and so on.
@ianfab
Thanks for the info, that sounds great. So except for the counting rules, S-Chess, Shatranj, Makruk, Ouk, and ASEAN basically all are ready for review/merge?
S-Chess, Shatranj and Courier are ready for review and merge (there are PRs).
Makruk, Ouk and ASEAN are close. I need info about the initial steps of Ouk Chatrang. There are contradictory accounts whether a capture deletes the initial move options, and whether a capture is possible by the initial steps by Advisor or King, and whether the King may also leap two ranks forward with a Horse move. (edit having reviewed new sources, see below - answers in short: No, Yes, No.)
How have you dealt with the special moves in Ouk? Checking whether no piece has been captured and whether the king/queen are on their original squares is strictly speaking not sufficient to know whether their special moves are allowed, since they can move and retreat, so standard FENs are not sufficient to get that information although that are extremely rare situations.
Right, so the castling field might be used to store this information.
Perhaps the FEN indicators for castling rights "KQkq" can be used somehow. In standard chess, the castling FEN flag would disappear as soon as the King has been moved.
As for the captures, maybe we could look at the piece counts, or the material count? Any less than the initial count, special flag should be removed and so on.
@teakado : Ah, I now see you suggested this already. And exactly, the total number of pieces are counted for the no-captures-before-initial-leap rule (if this exists at all) are tested against 32, the initial number of pieces.
Now the book Gary Gifford: Thai Chess and Cambodian Chess - Makruk and Ouk Chatrang has arrived. I also watched some dozens Youtube videos about "Ouk Khmer".
The counting rules are as stated above: bare king case with 8, 16, 22, 32, 44 and 64 moves rules in that order of precedence. This counting of Pieces' Honour stops and eliminates the Board's Honour counting. It does not restart when the King of the weaker side captures.
Ouk has initial moves for Sdaach and Neang, but these are also allowed when there are less than 31 pieces on the board, after a capture. I have seen a couple of videos when Kings leaped sideways after a capture had already been made. The Cambodian Ouk Champion leaps with the Neang after a capture.
Initially a King may leap towards the the sides, but not to the squares on the third rank. . A King in check may not evade by Horse's leap. I have seen no evidence that capturing would be forbidden for the special moves.
@alwey Thanks for the clarifications. From my side only one thing is still unclear: Does counting due to a bare king apply if the stronger side still has pawns?
@ianfab : No counting at all if there are any unpromoted pawns on the board.
If the strong side has only non-promoted pawns on the board the counting will start when the last pawn promotes to a Queen (Ferz, Mantri, Met).
Ok, thanks, I'll have to fix a couple of things then.
@ianfab : Sorry, last week I did not understand that the Pieces' Honour counting is forbidden when a Pawn is presentc(see first messages).
@alwey No problem, apart from fixing the 32 < 44 thing I anyway waited with changes until we have clear picture of what rules will be used. Now that everything seems to be clarified, I will try to adjust my implementation.
@alwey How do you intend to deal with blocked positions or fortresses? I think that something like a 50-move rule (in cases where counting does not apply) is necessary even if not compliant with Makruk rules, otherwise positions like 4k3/8/1p1p1p1p/pPpPpPpP/P1P1P1P1/8/8/R2K3R w 0 1
might take thousands of moves to be adjudicated by three-fold repetition, and the engines' scores might also not be close zero, so the evaluation-based draw adjudication would not help either.
@ianfab : I included a non-standard rule for situations with Pawns on board (instead of the 3-fold repetition a true 32 repetitions rule) in order to finally stop merciless engines.
But your example evades this safeguard. The FIDE rules are more robust than the Makruk rules. I think there should be an absolute limit for game moves, say less than 1001 plies? Or the reversible move counter of standard chess could help, e.g. with a limit of 256 plies.
@alwey Yes, an absolute limit on the number of moves also would be an option. In my opinion it depends a bit on the frequency of such cases in practical play. If it occurs quite regularly in engine games, then such an absolute limit on the number of games might not be very practical, otherwise it might be the best option to avoid impacting game-play (as the 50 move rule might do) by artificial rules.
@ianfab : indeed, the additional rules should not be invasive.
Recently I observed a Stockfish-Stockfish game and I was convinced the 32-repetition limit would be triggered. But no, one engine suddenly chose another move and then lost the game. Moves 58-120 make 31 repetitions - and the engines did not know of a 32-repetition limit.
[Event "My Tournament"]
[Site "?"]
[Date "2018.01.10"]
[Round "1"]
[White "stockfish-mak-8ae928d"]
[Black "stockfish-mak-CE-d782b1f"]
[Result "0-1"]
[PlyCount "312"]
[TimeControl "30+0.3"]
[Variant "makruk"]
1. Nd2 {+0.35/17 0.99s} c5 {-0.34/18 3.3s} 2. Kc2 {+0.25/17 0.71s}
Kf7 {-0.43/19 1.3s} 3. Ne2 {+0.36/19 2.1s} Nc6 {-0.31/18 1.2s}
4. h4 {+0.40/19 0.73s} h5 {-0.31/20 3.4s} 5. Kb2 {+0.33/15 0.15s}
f5 {-0.32/17 0.92s} 6. e4 {+0.16/19 1.9s} Nf6 {-0.25/17 0.72s}
7. Nc4 {+0.22/18 0.60s} Mc7 {-0.15/16 0.58s} 8. Nf4 {+0.18/14 0.17s}
d5 {-0.02/19 2.4s} 9. exd5 {+0.45/20 0.72s} Nxd5 {-0.20/19 1.5s}
10. Sg2 {+0.13/21 4.2s} b5 {-0.07/20 1.4s} 11. Nd2 {-0.33/21 1.6s}
Nxf4 {+0.24/18 0.71s} 12. gxf4 {-0.36/20 0.80s} Kg7 {+0.34/20 0.60s}
13. Sc2 {-0.24/21 2.1s} Mb6 {+0.34/21 1.9s} 14. Mf2 {-0.32/20 0.82s}
Sf7 {+0.22/20 1.5s} 15. Mg3 {-0.26/20 0.94s} Rd8 {+0.21/20 0.90s}
16. Rhe1 {-0.20/22 0.61s} Sb7 {+0.15/16 0.14s} 17. Sf1 {-0.21/20 0.15s}
Rd7 {+0.34/19 0.66s} 18. Sf2 {-0.19/23 0.62s} Mc7 {+0.17/21 1.7s}
19. Re2 {-0.27/21 2.8s} Mb6 {+0.29/20 0.73s} 20. Ree1 {-0.30/20 1.1s}
Rd5 {+0.23/21 0.65s} 21. Se3 {-0.28/21 0.83s} Rdd8 {0.00/23 2.4s}
22. b4 {0.00/19 0.45s} a5 {+0.35/26 3.5s} 23. bxc5 {0.00/20 1.5s}
Mxc5 {+0.55/14 0.28s} 24. d4 {-0.53/16 0.29s} Md6 {0.00/21 1.8s}
25. a4 {-0.31/20 0.42s} b4 {0.00/22 0.94s} 26. c4 {0.00/17 0.35s}
Nb8 {0.00/20 0.57s} 27. Nb3 {0.00/21 0.54s} Nd7 {0.00/23 0.48s}
28. Sd3 {0.00/21 0.28s} Sc6 {0.00/22 0.12s} 29. Re2 {0.00/26 0.56s}
Mc7 {0.00/26 0.40s} 30. Rc2 {+0.18/28 3.9s} Nf6 {0.00/18 1.0s}
31. c5 {+0.27/24 2.7s} Rdb8 {-0.08/19 0.44s} 32. Sc4 {+0.25/18 0.20s}
Se8 {-0.32/19 0.67s} 33. Re1 {+0.11/20 0.82s} Kh7 {-0.25/19 0.31s}
34. Nc1 {+0.45/15 0.28s} Nd7 {-0.27/18 0.63s} 35. Nd3 {+0.34/19 0.64s}
Kg7 {-0.50/18 0.44s} 36. Kb3 {+0.41/17 0.12s} Ra7 {-0.40/16 0.31s}
37. Ne5 {+0.41/20 0.41s} Nxe5 {-0.58/20 0.29s} 38. fxe5 {+1.25/22 2.6s}
Md8 {-0.44/21 0.15s} 39. Sf4 {+1.25/20 0.64s} Rd7 {-1.20/14 0.45s}
40. Sd3 {+1.26/19 0.33s} Rc8 {-1.23/14 0.30s} 41. Sg5 {+1.41/18 0.18s}
Sd5 {-1.50/15 0.30s} 42. Rd1 {+1.24/20 0.41s} Me7 {-1.72/17 0.30s}
43. Mf4 {+1.31/18 0.17s} Kh7 {-1.55/16 0.26s} 44. Me3 {+1.05/20 0.41s}
Sc6 {-0.99/16 0.18s} 45. Sc4 {+1.40/18 0.051s} Rb7 {-0.75/16 0.13s}
46. Ra2 {+1.30/20 0.57s} Rd8 {-0.80/18 0.43s} 47. Sb5 {+1.08/19 0.30s}
Sxc5 {-0.72/17 0.35s} 48. Rc2 {+1.03/18 0.25s} Sb6 {-1.40/15 0.080s}
49. Sxb6 {+1.03/15 0.039s} Rxb6 {-0.93/16 0.18s} 50. Rdc1 {+1.62/19 0.61s}
Kg7 {-1.25/18 0.51s} 51. Rc7 {+1.35/19 0.29s} Ra6 {-1.14/18 0.32s}
52. Rg1 {+1.25/16 0.030s} Kf8 {-1.46/21 0.56s} 53. Sxg6 {+1.44/14 0.14s}
f4 {-1.17/16 0.15s} 54. Rg5 {0.00/20 0.74s} fxe3=M {0.00/17 0.10s}
55. Sg7+ {0.00/19 0.040s} Kf7 {0.00/1 0.002s} 56. Sf6+ {0.00/22 0.27s}
Kf8 {0.00/1 0s} 57. Rxh5 {0.00/22 0.037s} Kg8 {0.00/23 0.25s}
58. Rg5+ {0.00/21 0.25s} Kf8 {0.00/23 0.15s} 59. Sg7+ {0.00/24 0.18s}
Kf7 {0.00/1 0s} 60. Sf6+ {0.00/24 0.039s} Kf8 {0.00/1 0s}
61. Sg7+ {0.00/26 0.19s} Kf7 {0.00/1 0s} 62. Sf6+ {0.00/26 0.059s}
Kf8 {0.00/1 0s} 63. Sg7+ {0.00/28 0.23s} Kf7 {0.00/1 0s}
64. Sf6+ {0.00/31 0.21s} Kf8 {0.00/1 0s} 65. Sg7+ {0.00/30 0.58s}
Kf7 {0.00/1 0s} 66. Sf6+ {0.00/33 0.30s} Kf8 {0.00/1 0s}
67. Sg7+ {0.00/31 0.44s} Kf7 {0.00/1 0s} 68. Sf6+ {0.00/35 0.52s}
Kf8 {0.00/1 0s} 69. Sg7+ {0.00/32 0.93s} Kf7 {0.00/1 0s}
70. Sf6+ {0.00/36 0.23s} Kf8 {0.00/1 0s} 71. Sg7+ {0.00/34 0.59s}
Kf7 {0.00/1 0s} 72. Sf6+ {0.00/36 0.30s} Kf8 {0.00/1 0s}
73. Sg7+ {0.00/33 0.30s} Kf7 {0.00/1 0s} 74. Sf6+ {0.00/36 0.14s}
Kf8 {0.00/1 0s} 75. Sg7+ {0.00/33 0.33s} Kf7 {0.00/1 0s}
76. Sf6+ {0.00/38 0.42s} Kf8 {0.00/1 0s} 77. Sg7+ {0.00/35 0.30s}
Kf7 {0.00/1 0s} 78. Sf6+ {0.00/38 0.13s} Kf8 {0.00/1 0s}
79. Sg7+ {0.00/34 0.20s} Kf7 {0.00/1 0s} 80. Sf6+ {0.00/40 0.57s}
Kf8 {0.00/1 0s} 81. Sg7+ {0.00/35 0.30s} Kf7 {0.00/1 0s}
82. Sf6+ {0.00/38 0.30s} Kf8 {0.00/1 0s} 83. Sg7+ {0.00/35 0.30s}
Kf7 {0.00/1 0s} 84. Sf6+ {0.00/40 0.30s} Kf8 {0.00/1 0s}
85. Sg7+ {0.00/35 0.29s} Kf7 {0.00/1 0s} 86. Sf6+ {0.00/39 0.30s}
Kf8 {0.00/1 0s} 87. Sg7+ {0.00/35 0.31s} Kf7 {0.00/1 0s}
88. Sf6+ {0.00/40 0.30s} Kf8 {0.00/1 0s} 89. Sg7+ {0.00/35 0.30s}
Kf7 {0.00/1 0s} 90. Sf6+ {0.00/39 0.24s} Kf8 {0.00/1 0s}
91. Sg7+ {0.00/35 0.36s} Kf7 {0.00/1 0s} 92. Sf6+ {0.00/41 0.29s}
Kf8 {0.00/1 0s} 93. Sg7+ {0.00/33 0.32s} Kf7 {0.00/1 0s}
94. Sf6+ {0.00/41 0.29s} Kf8 {0.00/1 0s} 95. Sg7+ {0.00/36 0.30s}
Kf7 {0.00/1 0s} 96. Sf6+ {0.00/42 0.30s} Kf8 {0.00/1 0s}
97. Sg7+ {0.00/33 0.20s} Kf7 {0.00/1 0s} 98. Sf6+ {0.00/41 0.40s}
Kf8 {0.00/1 0s} 99. Sg7+ {0.00/34 0.17s} Kf7 {0.00/1 0s}
100. Sf6+ {0.00/40 0.27s} Kf8 {0.00/1 0s} 101. Sg7+ {0.00/36 0.47s}
Kf7 {0.00/1 0s} 102. Sf6+ {0.00/41 0.30s} Kf8 {0.00/1 0s}
103. Sg7+ {0.00/33 0.17s} Kf7 {0.00/1 0s} 104. Sf6+ {0.00/41 0.43s}
Kf8 {0.00/1 0s} 105. Sg7+ {0.00/35 0.30s} Kf7 {0.00/1 0s}
106. Sf6+ {0.00/41 0.29s} Kf8 {0.00/1 0s} 107. Sg7+ {0.00/36 0.31s}
Kf7 {0.00/1 0s} 108. Sf6+ {0.00/35 0.19s} Kf8 {0.00/1 0s}
109. Sg7+ {0.00/36 0.41s} Kf7 {0.00/1 0s} 110. Sf6+ {0.00/41 0.28s}
Kf8 {0.00/1 0s} 111. Sg7+ {0.00/36 0.32s} Kf7 {0.00/1 0s}
112. Sf6+ {0.00/41 0.30s} Kf8 {0.00/1 0s} 113. Sg7+ {0.00/36 0.29s}
Kf7 {0.00/1 0s} 114. Sf6+ {0.00/41 0.30s} Kf8 {0.00/1 0s}
115. Sg7+ {0.00/36 0.30s} Kf7 {0.00/1 0s} 116. Sf6+ {0.00/42 0.15s}
Kf8 {0.00/1 0s} 117. Sg7+ {0.00/37 0.45s} Kf7 {0.00/1 0s}
118. Sf6+ {0.00/34 0.14s} Kf8 {0.00/1 0s} 119. Sg7+ {0.00/37 0.35s}
Kf7 {0.00/1 0s} 120. Sf6+ {0.00/39 0.24s} Kf8 {0.00/1 0s}
121. Rg8+ {0.00/38 0.37s} Kxg8 {+8.07/1 0s} 122. Sg5 {-9.77/15 0.40s}
Rxd4 {+10.06/17 0.93s} 123. Rc8 {-10.07/16 0.30s} Kf8 {+10.38/18 0.78s}
124. Rc4 {-10.40/16 0.30s} Rd3+ {+10.92/19 1.1s} 125. Kc2 {-10.45/17 0.30s}
Rd2+ {+11.31/21 1.3s} 126. Kb3 {-10.90/17 0.30s} Rf2 {+11.33/20 0.20s}
127. Rg4 {-11.01/18 0.30s} Rxf3 {+11.48/23 0.71s} 128. Kc4 {-11.30/20 0.30s}
Rb6 {+11.64/21 0.23s} 129. Kc5 {-11.44/21 0.30s} Rb8 {+12.26/22 0.73s}
130. Kc6 {-11.46/19 0.046s} b3=M {+12.27/22 0.21s} 131. Kc7 {-11.58/22 0.55s}
Rb4 {+12.37/26 0.76s} 132. Rxb4 {-11.77/24 0.30s} axb4 {+12.37/27 0.27s}
133. a5 {-12.38/21 0.30s} Mf4 {+12.43/28 0.90s} 134. Sg6 {-12.59/21 0.30s}
Rg3 {+12.45/24 0.20s} 135. h5 {-12.76/22 0.30s} Mc4 {+12.55/25 0.69s}
136. Kb6 {-12.85/19 0.23s} b3=M {+12.55/27 0.41s} 137. a6=M {-13.32/21 0.34s}
Mxe5 {+12.86/27 6.9s} 138. Kc5 {-13.17/21 0.32s} Md5 {+13.05/19 0.50s}
139. Mb7 {-13.47/18 0.30s} Me4 {+13.05/21 0.66s} 140. Mc6 {-13.63/21 0.30s}
Mf5 {+13.10/20 0.32s} 141. Sxf5 {-14.09/18 0.29s} exf5 {+13.10/21 0.83s}
142. Kd5 {-14.03/22 0.14s} M7d6 {+14.40/18 0.71s} 143. Ke6 {-59.20/23 0.36s}
f4 {+14.14/20 2.1s} 144. h6=M {-58.20/19 0.21s} Se7+ {+14.55/16 0.44s}
145. Kd7 {-59.80/27 0.34s} Mc2 {+14.50/20 2.5s} 146. Kc8 {-59.85/23 0.21s}
Rg6 {+14.40/18 2.0s} 147. Mb5 {-59.90/26 0.20s} Rxh6 {+14.25/17 0.57s}
148. Ma4 {-59.90/27 0.18s} Mc5 {+14.45/16 0.23s} 149. Mb5 {-M24/25 0.42s}
Rb6 {+M19/19 0.18s} 150. Mc6 {-M14/26 0.22s} Rxc6+ {+M13/29 0.21s}
151. Kb7 {-M12/27 0.040s} Rb6+ {+M11/31 0.23s} 152. Ka8 {-M10/36 0.23s}
f3=M {+M9/30 0.060s} 153. Ka7 {-M8/1 0s} Ke8 {+M7/49 0.24s} 154. Ka8 {-M6/1 0s}
Kd7 {+M5/105 0.050s} 155. Ka7 {-M4/1 0s} Kc7 {+M3/127 0.008s}
156. Ka8 {-M2/1 0.001s} Ra6# {+M1/127 0.007s, Black mates} 0-1
@alwey I have not removed the 50 move rule yet. With the first counting rule implementation I had only changed 50 to 64. Therefore, it is not surprising that it played a random (non-capturing) move on the 32nd repetition.
I pushed a fix for the counting rules. Except for three-fold repetition and the 64-move rule it should be fully compliant with the Makruk rules now, at least the bugs I am aware of should be fixed.
Regarding the adjudication by game length or half-move clock, practice will tell which approach and which ply count is the most practical. For now I keep the 64-move rule.
Edit: Found one more bug, but is fixed now.
@ianfab: Thank you!
In between, I have read too much about Makruk and Ouk rules and because of the contradictions between the sources I am sufficiently confused.
I will upload a PR as a preview to cutechess soon and list what is still missing and what has to be clarified. It would be good to hear the opinion of an expert in Southeast Asian Chess.
@alwey Hi, I came across the official ASEAN chess rules here:
http://aseanchess.org/laws-of-asean-chess/
Differences from Makruk seem to be:
HGM's website, as well as its mirror hosted on GNU.org, state that the pawns always promote to Ferz, upon reaching the last rank. Despite this, the built-in ASEAN variant in xboard 4.9.1 promotes to Rook by default when using a mouse as input, and also accepts promotion to other pieces (incl. the King!) when the move is typed in.
Hello @teakado , thank you. I actually already implemented ASEAN chess using exactly that source some days ago. With respect to ASEAN there is only one point unclear to me so far:
Special endgame counts, paragraph 5.2e (EDIT: corrected number)
e. As soon as a player has only a king left on his side, the number of pieces belong to the opponent shall be observed. The game may be drawn if the player having only a king (lone king) left on his side can manage to escape in a number of fixed moves (move count shall be done starting from the very first move of lonely king) against the opponent of having particular pieces shown below: Lone King vs. King & A Rook 16 moves Lone King vs. King & A Bishop & A Queen 44 moves Lone King vs. King & A Knight & A Queen 64 moves
Do these counts apply only to exact material like KR vs K (16 moves) or do the rules apply to material at least KR vs K, like KRP vs K and KRR vs K. The former (exact KR vs K) case would be unlogical IMO.
Hello ianfab. Thank you for your work. I find bug. Some game in endgame ai StockfishMK will win because piece and position very Competitor advantage. but ai StockfishMK don't win because ai don't move to attack antagonist.Always make Draw not Win Can you fix problem it in endgame and syzygy. Thank you very much. Regard.
ai don't attack and Promote
[Event "Computer Chess Game"] [Site "WORADET"] [Date "2018.01.28"] [Round "4"] [White "Bilis 1.0"] [Black "Stockfish 280118 64 (UCI2WB)"] [Result "0-1"] [TimeControl "60+1"] [Variant "makruk"] [Annotator "1. +0.09 1... -0.09"]
@woradet Thanks for your feedback. This project is still in a very early stage, especially the evaluation code related to the counting rules is rather experimental, so it might well be that you find more such issues. The game you posted was very helpful for debugging and revealed two issues:
I pushed two changes to address the aforementioned issues. The passed pawn evaluation will perhaps require further tweaks in the future, but it should at least be a bit more realistic now.
Thank you very much Sir.ianfab current src 29/1/61 still don't attack and promote [Event "Computer Chess Game"] [Site "WORADET"] [Date "2018.01.29"] [Round "-"] [White "Stockfish 290118 64 (UCI2WB)"] [Black "Bilis 0.14"] [Result "1/2-1/2"] [TimeControl "60+1"] [Variant "makruk"] [FEN "8/5n1k/5rm1/PP6/1NM5/1K6/8/6R1 w 0 1"] [SetUp "1"]
{-------------- . . . . . . . . . . . . . n . k . . . . . r m . P P . . . . . . . N M . . . . . . K . . . . . . . . . . . . . . . . . . . . R . white to play --------------}
@woradet Thanks, these PGNs are really helpful. I found one more issue when analyzing the second game. The main reason why it avoids promotion there is that endgames are evaluated as drawish if the stronger side only has a slight material advantage and only one pawn is left. That makes sense in normal chess, but not so much in Makruk, so I will change or remove that.
When testing with Xboard, the adjudication settings of xboard should be adapted to Makruk.
-ruleMoves n
If the given value is non-zero, XBoard adjudicates the game as a
draw after the given number of consecutive reversible moves.
Engine draw claims are always accepted after 50 moves, irrespec‐
tive of the given value of n.
-repeatsToDraw n
If the given value is non-zero, xboard adjudicates the game as a
draw if a position is repeated the given number of times.
Engines draw claims are always accepted after 3 repeats, (on the
3rd occurrence, actually), irrespective of the value of n.
Beware that positions that have different castling or en-passant
rights do not count as repeats, XBoard is fully e.p. and
castling aware!
-trivialDraws true/false
If this option is set, XBoard adjudicates games as draws that
cannot be usually won without opponent cooperation. This applies
to KBKB with unlike bishops, and to KBKN, KNKN, KNNK, KRKR and
KQKQ. The draw is called after 6 ply into these end-games, to
allow quick mates that can occur in some exceptional positions
to be found by the engines. KQKQ does not really belong in this
category, and might be taken out in the future. (When bitbase-
based adjudications are implemented.) Legality-testing must be
on for this option to work. Default: false
@woradet FYI: I splitted out the discussion about the passed pawn/promotion issue to a separate thread in order to better keep track of the open issues.
@ianfab CuteChess MakrukBoard
supports both chess counting rules and Makruk counting. During a game all of the Western and Makruk counters are active. The set-up situation decides whether the chess or the Makruk counters are effective.
If given a standard-like FEN like rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w - - 0 1
or shortened FEN like rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w 0 1
the chess counting rules will apply.
If given an extended counter FEN like the default FEN string
rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w - 0 0 1
the Makruk counting rules will decide.
@alwey Thanks. So the formats can always be distinguished by checking whether the en-passant field is a digit or not, right? If I find the time, I will implement the format with Makruk counting.
checking whether the en-passant field is a digit or not, right?
Right, cutechess does the same at start when parsing the FEN. If an integer can be parsed at the ep field then Makruk rules apply. Then the output FEN also will have Makruk counters.
Zero or negative integer values will give very short games....
Since a proper handling of counting rules is implemented in Fairy-Stockfish and since the latter already is on par with this fork in terms of playing strength (despite the factor 2 difference in speed), I currently do not plan to improve the counting rules here any more.
The support of Sittuyin and ASEAN requested in this thread is also already addressed, so I do not see any more open points and am closing this. If there is an open point I missed or if you have any further feedback, please let me know.
https://en.wikipedia.org/wiki/Makruk#Counting_rules