Makruk

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Makruk

Post by Evert »

Over the past week or so I've developed a new interest in Makruk (Thai chess) and I've been looking into it a bit.

As I already knew, the draw rate is pretty high, although it seems to come down a bit if you make the evaluation aware of drawish endings that it should avoid. The difficulty is that a one or two piece advantage may not be enough to win the end game if you cannot avoid trading any more pieces (as opposed to winning them), simply because most of the pieces are rather weak and you need three (rather than two) to mate a lone king (I think the silver general is an exception here and KSNK for instance may be won, but I'm not entirely sure). That doesn't mean that endings like KFFFKF are generally draws, because the king is quite capable of chasing after the lone ferz and the ferzes can annoy the defending king quite well if they work together.

This balance between when to encourage simplification (through trading) and when to stop doing that (because you'll trade away your advantage) is something I have yet to get right. Understanding what evaluation terms are important is also something I have yet to do (forward mobility for the ferz and silver seems to be quite important, as does king safety, but I haven't managed to tune those effectively yet), but my impression is that I will first need to better recognise when the game goes from "clear material advantage" to "meaningless material advantage". I've tried to find some reference to strategy or hints on how to play the game, but most on-line resources I've been able to find are completely useless because they only discuss the rules of the game.

Does anyone have any insight in this?
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Makruk

Post by Ferdy »

Evert wrote:Over the past week or so I've developed a new interest in Makruk (Thai chess) and I've been looking into it a bit.

As I already knew, the draw rate is pretty high, although it seems to come down a bit if you make the evaluation aware of drawish endings that it should avoid. The difficulty is that a one or two piece advantage may not be enough to win the end game if you cannot avoid trading any more pieces (as opposed to winning them), simply because most of the pieces are rather weak and you need three (rather than two) to mate a lone king (I think the silver general is an exception here and KSNK for instance may be won, but I'm not entirely sure). That doesn't mean that endings like KFFFKF are generally draws, because the king is quite capable of chasing after the lone ferz and the ferzes can annoy the defending king quite well if they work together.

This balance between when to encourage simplification (through trading) and when to stop doing that (because you'll trade away your advantage) is something I have yet to get right. Understanding what evaluation terms are important is also something I have yet to do (forward mobility for the ferz and silver seems to be quite important, as does king safety, but I haven't managed to tune those effectively yet), but my impression is that I will first need to better recognise when the game goes from "clear material advantage" to "meaningless material advantage". I've tried to find some reference to strategy or hints on how to play the game, but most on-line resources I've been able to find are completely useless because they only discuss the rules of the game.

Does anyone have any insight in this?
KSNk is a sure win especially if k is in front of S. But you have to observe also the counting rules,
according to the rule, white has to mate black in 44 moves.

In KFFFkf the color is very important, same color F as in KFFFk can not win.

In Bilis, evaluation of color of queen or F gives a nice improvement, When there are more than 1 F, make sure
that there is white and black color. In ending with KNFk, drive the black king to the corner with color same to F.
This is similar to KNBk in fide chess, the released version of Bilis is blind to this, but my latest version has already
this knowledge. It is in my todo list to release this version. Piece centralization is also good for evaluation,
Nebiyu is expert on this. I also have piece mobilities and some bonus for piece close to opponent king.
Driving opponent king in the corner is always better.
The file of the pawn has to be evaluated also, as this determines the color of the F when pawn is promoted, very
critical in F endings.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Makruk

Post by Evert »

Ferdy wrote: KSNk is a sure win especially if k is in front of S. But you have to observe also the counting rules,
according to the rule, white has to mate black in 44 moves.
I haven't bothered with counting rules yet (no GUI support for those anyway), but that's something I'll come to eventually (with an option to turn them off).
In KFFFkf the color is very important, same color F as in KFFFk can not win.
Of course.
In Bilis, evaluation of color of queen or F gives a nice improvement, When there are more than 1 F, make sure
that there is white and black color.
Yes, I need to add that. I'm also going to look into some non-linear stuff with multiple ferzes, but I haven't thought about this much yet.
In ending with KNFk, drive the black king to the corner with color same to F.
This is similar to KNBk in fide chess, the released version of Bilis is blind to this, but my latest version has already
this knowledge.
But in general KFNK is a draw (http://www.chessvariants.org/misc.dir/endgames.html). A more interesting case is KFSK. Sjaak's static evaluator insists that this is also a draw, but I'm not sure it's correctly treating the asymmetric nature of the silver (I think it may try to mate a black king on a1, in which case the silver is no more useful than a ferz).
It is in my todo list to release this version. Piece centralization is also good for evaluation,
Nebiyu is expert on this. I also have piece mobilities and some bonus for piece close to opponent king.
Driving opponent king in the corner is always better.
The file of the pawn has to be evaluated also, as this determines the color of the F when pawn is promoted, very
critical in F endings.
What about blocked pawn structures? The range of the pawns is not very big, so my initial impression was that they wouldn't be that interesting, but I've seen a few games where several rammed pawns that are separated by two files effectively block the ferzes and silvers behind enemy lines.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Makruk

Post by hgm »

If there is real interest in Makruk I can implement the counting rules in WinBoard. They are not really much different from the 50-move rule. To implement that WinBoard goes back through the game history to the last reversible move, and if that exceeds 100 ply it calls it a draw.In Makruk it would have to scan back to the last capture, and decide from the material after tha capture if it exceeds the max count and is thus draw. If not, it would have to continue scanning to the previous capture and repeat the process, untill it reaches a material composition where no count limit exists.

As to KSNK, according to my asymmetric 4-men generator it is a general win. (This generator does not take into account that KSK has some mate positions, but considers all captures of an unprotected N a draw, so the numbers should be considered pessimistic estimates.)

Code: Select all

        mated    mate
King captures 3493834
mates    1100         ( 0.14 sec)
in-1      556    3124 ( 0.19 sec)
in-2      714    3114 ( 0.23 sec)
in-3     2224    3850 ( 0.30 sec)
in-4     3568   12298 ( 0.34 sec)
in-5     7932   17742 ( 0.41 sec)
in-6    12094   35570 ( 0.45 sec)
in-7    19896   49066 ( 0.52 sec)
in-8    25028   74838 ( 0.59 sec)
in-9    31888   84646 ( 0.67 sec)
in-10   40152  104336 ( 0.75 sec)
in-11   54518  123042 ( 0.83 sec)
in-12   71576  160624 ( 0.92 sec)
in-13  101644  190088 ( 1.03 sec)
in-14  139564  254150 ( 1.16 sec)
in-15  183158  314062 ( 1.30 sec)
in-16  236626  383746 ( 1.47 sec)
in-17  306722  461460 ( 1.66 sec)
in-18  405580  557768 ( 1.88 sec)
in-19  548500  678256 ( 2.14 sec)
in-20  702910  826334 ( 2.47 sec)
in-21  865518  954332 ( 2.84 sec)
in-22 1003754 1057358 ( 3.25 sec)
in-23 1108196 1119422 ( 3.70 sec)
in-24 1139390 1112810 ( 4.19 sec)
in-25 1051018  977282 ( 4.61 sec)
in-26  844270  741134 ( 4.98 sec)
in-27  592726  471760 ( 5.26 sec)
in-28  362544  263038 ( 5.47 sec)
in-29  191122  129664 ( 5.61 sec)
in-30   90460   58746 ( 5.70 sec)
in-31   38162   23832 ( 5.76 sec)
in-32   14138    9522 ( 5.83 sec)
in-33    4822    3596 ( 5.89 sec)
in-34    1720    1324 ( 5.94 sec)
in-35     636     514 ( 6.00 sec)
in-36     174     176 ( 6.05 sec)
in-37      40      44 ( 6.09 sec)
in-38       8      18 ( 6.14 sec)
in-39       0       0 ( 6.20 sec)
won:   14756520 ( 96.8%)
lost:  10204648 ( 66.9%)
avg:       22.2 moves
KFSK is also a general win, provided that your Ferz isn't born in a place where it is doomed (hence only 88% wtm wins, rather than the usual 95+%):

Code: Select all

        mated    mate
King captures 3078720
mates    1088         ( 0.11 sec)
in-1      450    2874 ( 0.16 sec)
in-2      426    2672 ( 0.22 sec)
in-3     1228    2170 ( 0.27 sec)
in-4      976    6952 ( 0.31 sec)
in-5     2146    5126 ( 0.38 sec)
in-6     3852   10154 ( 0.42 sec)
in-7     5934   16546 ( 0.48 sec)
in-8     9126   23362 ( 0.53 sec)
in-9    12616   33578 ( 0.59 sec)
in-10   16164   41386 ( 0.66 sec)
in-11   19040   50466 ( 0.72 sec)
in-12   21630   56714 ( 0.80 sec)
in-13   25008   64418 ( 0.86 sec)
in-14   34446   73868 ( 0.92 sec)
in-15   45662   94668 ( 1.00 sec)
in-16   58278  115398 ( 1.09 sec)
in-17   72332  137780 ( 1.17 sec)
in-18   83802  159320 ( 1.27 sec)
in-19   96358  173832 ( 1.38 sec)
in-20  112316  187364 ( 1.48 sec)
in-21  123274  208042 ( 1.59 sec)
in-22  139920  216872 ( 1.70 sec)
in-23  156122  235094 ( 1.83 sec)
in-24  181678  247788 ( 1.95 sec)
in-25  196834  268896 ( 2.09 sec)
in-26  221870  275176 ( 2.22 sec)
in-27  239706  293304 ( 2.38 sec)
in-28  257308  314390 ( 2.52 sec)
in-29  281370  335474 ( 2.69 sec)
in-30  301452  371300 ( 2.86 sec)
in-31  337760  407986 ( 3.05 sec)
in-32  403588  466190 ( 3.25 sec)
in-33  494180  553884 ( 3.48 sec)
in-34  597308  662580 ( 3.75 sec)
in-35  677996  749762 ( 4.03 sec)
in-36  711266  783550 ( 4.33 sec)
in-37  683968  757314 ( 4.64 sec)
in-38  628572  658150 ( 4.91 sec)
in-39  514796  523206 ( 5.14 sec)
in-40  375324  359454 ( 5.33 sec)
in-41  239444  211188 ( 5.48 sec)
in-42  141716  119974 ( 5.59 sec)
in-43   82136   72094 ( 5.67 sec)
in-44   45584   40366 ( 5.75 sec)
in-45   24358   21078 ( 5.81 sec)
in-46   13814   11766 ( 5.88 sec)
in-47    7166    6742 ( 5.92 sec)
in-48    3628    3516 ( 5.97 sec)
in-49    1546    1710 ( 6.03 sec)
in-50     842     818 ( 6.08 sec)
in-51     502     474 ( 6.13 sec)
in-52     316     278 ( 6.19 sec)
in-53      70      84 ( 6.23 sec)
in-54      24      20 ( 6.28 sec)
in-55      18      26 ( 6.34 sec)
in-56      10       6 ( 6.39 sec)
in-57       4       8 ( 6.44 sec)
in-58       0       0 ( 6.50 sec)
won:   13515928 ( 88.6%)
lost:   8708348 ( 57.1%)
avg:       32.5 moves
KNFK is a general draw, with some wins:

Code: Select all

        mated    mate
King captures 3319008
mates     160         ( 0.13 sec)
in-1       88     536 ( 0.19 sec)
in-2       48     240 ( 0.23 sec)
in-3      216     392 ( 0.28 sec)
in-4      200    1456 ( 0.33 sec)
in-5      920    1736 ( 0.39 sec)
in-6      664    5956 ( 0.44 sec)
in-7     2956    5464 ( 0.48 sec)
in-8      980   15912 ( 0.55 sec)
in-9     3536    7032 ( 0.59 sec)
in-10    2372   15232 ( 0.66 sec)
in-11    4340   11592 ( 0.70 sec)
in-12    3492   18400 ( 0.77 sec)
in-13    4756   14568 ( 0.81 sec)
in-14    4664   21748 ( 0.88 sec)
in-15    5280   20972 ( 0.94 sec)
in-16    4484   21996 ( 0.98 sec)
in-17    4532   19032 ( 1.05 sec)
in-18    3912   17468 ( 1.09 sec)
in-19    4848   14956 ( 1.16 sec)
in-20    5008   17832 ( 1.20 sec)
in-21    4752   17100 ( 1.27 sec)
in-22    6464   18008 ( 1.33 sec)
in-23    8784   24640 ( 1.38 sec)
in-24    9596   27492 ( 1.44 sec)
in-25    7664   27744 ( 1.50 sec)
in-26    8672   23436 ( 1.56 sec)
in-27    6676   23524 ( 1.61 sec)
in-28    6592   20140 ( 1.67 sec)
in-29    5132   16764 ( 1.73 sec)
in-30    2488   12112 ( 1.78 sec)
in-31    3212    7752 ( 1.83 sec)
in-32    2732   10416 ( 1.89 sec)
in-33    1220    7696 ( 1.94 sec)
in-34     160    3292 ( 2.00 sec)
in-35      32     216 ( 2.05 sec)
in-36       8      48 ( 2.09 sec)
in-37       0       0 ( 2.14 sec)
won:    3791908 ( 24.9%)
lost:    131640 (  0.9%)
avg:       20.6 moves
KFFK is also draw, apart from some mate-in-1 and 2 when the King is already trapped in a corner, which you never can force. (So in practice about as drawish as KNNK.)

Code: Select all

        mated    mate
King captures 2897064
mates     160         ( 0.11 sec)
in-1       32     320 ( 0.17 sec)
in-2        0      96 ( 0.22 sec)
won:    2897480 ( 19.0%)
lost:       192 (  0.0%)
avg:        0.2 moves
The asymmetric generator cannot do 5-men, but as S + any single piece is always a win, the only interesting 4+1-men are KNFFK and KFFFK, which are 8-fold symmetric. So these can be calculated with FairyGen, and both are generally won. The latter under the assumption that not all Ferz are the same color, of course. For KNFFK the color of the Ferz does not matter, and even with like Ferz mate can be forced in both corners. Although in one corner it was much more difficult to find in forward search than in the other.

My guess would be that when you are ahead in piece material (and none of your Ferzes is doomed) you should be able to prevent opponent promotions, and in the end force trading of the pieces the opponent has left while preserving your Pawns, and then promote the latter. Whether the advantage is winning should then be determined from the color of the Ferzes you would get that way.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Makruk

Post by hgm »

FairyGen DTM output (offset by 1, as FairyGen counts to King capture):

Code: Select all

KNFF_K

WON.wtm  106559466  109525160
K capture 28436780   30070168
other     78122686   79454992
  0.      36223390   39045808
  1.          3092       5156
  2.          1356       2116
  3.           936       1204
  4.          4428       5912
  5.          7044      11844
  6.         21750      37492
  7.         25592      61420
  8.         59212     134140
  9.         52886     151924
 10.         83332     232468
 11.         96762     290212
 12.        121640     416740
 13.        168084     573156
 14.        214904     841072
 15.        312900    1237852
 16.        441026    1844036
 17.        639688    2727736
 18.        897832    3998008
 19.       1306156    5664520
 20.       1859092    7436136
 21.       2655788    8766580
 22.       3717146    9019016
 23.       5130070    7966368
 24.       6674896    6021912
 25.       8116402    3881672
 26.       8893082    2174984
 27.       8399746    1167256
 28.       6611262     611972
 29.       4298120     321192
 30.       2416904     201192
 31.       1263966     153664
 32.        632492     116540
 33.        316802      92480
 34.        164168      69324
 35.         93850      55856
 36.         52170      42044
 37.         32092      28264
 38.         22512      18088
 39.         12504       9420
 40.          4576       4340
 41.          1612       1920
 42.           616        452
 43.           106        164
 44.             0         60
 45.             0         44
WON.btm   65828594   66397948
stalemate    86030      91276
W check   10414306   10648008
LEGAL    102138014  105535032
TOTAL    112552320  116183040

Code: Select all

KFFF_K

WON.wtm   12022920  101235764          0   50617882
K capture 12022920   27108240          0   13554120
other            0   74127524          0   37063762
  0.      52784292   48624274          0   24312220
  1.             0       5064          0       2532
  2.             0       1080          0        540
  3.             0        272          0        136
  4.             0        656          0        328
  5.             0       2816          0       1408
  6.             0       7288          0       3644
  7.             0      17228          0       8614
  8.             0      28416          0      14208
  9.             0      55248          0      27624
 10.             0      73004          0      36502
 11.             0     114636          0      57318
 12.             0     142588          0      71294
 13.             0     186504          0      93252
 14.             0     219448          0     109724
 15.             0     276244          0     138122
 16.             0     376740          0     188370
 17.             0     494736          0     247368
 18.             0     741280          0     370640
 19.             0    1131224          0     565612
 20.             0    1681980          0     840990
 21.             0    2466836          0    1233418
 22.             0    3581708          0    1790854
 23.             0    4974056          0    2487028
 24.             0    6319988          0    3159994
 25.             0    7309288          0    3654644
 26.             0    7463668          0    3731834
 27.             0    6668976          0    3334488
 28.             0    5240620          0    2620310
 29.             0    3617068          0    1808534
 30.             0    2209172          0    1104586
 31.             0    1288000          0     644000
 32.             0     757832          0     378916
 33.             0     402504          0     201252
 34.             0     189128          0      94564
 35.             0      77120          0      38560
 36.             0      24792          0      12396
 37.             0       9856          0       4928
 38.             0       6488          0       3244
 39.             0       3936          0       1968
 40.             0       1608          0        804
 41.             0        264          0        132
WON.btm          0   58169360          0   29084680
stalemate    39024      90208          0      45104
W check    1637484    9299198          0    4649516
LEGAL     52823316  106883842          0   53442004
TOTAL     54460800  116183040          0   58091520
KRKN is draw, as in orthodox Chess. An extra Ferz is enough to tip the scales, though:

Code: Select all

KRF_KN

WON.wtm  226744024
K capture 73510494
other    153233530
  0.      55806986
  1.        144770
  2.        104886
  3.        101398
  4.        117446
  5.        105206
  6.        128619
  7.        218738
  8.        311733
  9.        445465
 10.        654728
 11.        909941
 12.       1345322
 13.       2051979
 14.       2965521
 15.       3935019
 16.       4170857
 17.       3803655
 18.       3521265
 19.       3347167
 20.       3220112
 21.       3154808
 22.       3163641
 23.       3307370
 24.       3646676
 25.       4097943
 26.       4605113
 27.       5109553
 28.       5586820
 29.       6056887
 30.       6475363
 31.       6928691
 32.       7302308
 33.       7589045
 34.       7639749
 35.       7366663
 36.       6889275
 37.       6202499
 38.       5083590
 39.       3600154
 40.       2110042
 41.        954744
 42.        293129
 43.         33559
 44.          5566
 45.          1788
 46.           698
 47.           406
 48.           218
 49.           126
 50.            88
WON.btm  138810339
stalemate      854
W check   34117181
LEGAL    194618179
TOTAL    228735360
KRKF is also generally won:

Code: Select all

KR_KF

WON.wtm    3806818
K capture  1117074
other      2689744
  0.        516494
  1.          2742
  2.          2320
  3.          1158
  4.          1695
  5.          1799
  6.          2825
  7.          4490
  8.          6101
  9.          9349
 10.         16926
 11.         21896
 12.         32481
 13.         51936
 14.         80398
 15.        129185
 16.        210772
 17.        260612
 18.        260494
 19.        237451
 20.        194392
 21.        178369
 22.        167752
 23.        175879
 24.        191874
 25.        197879
 26.        156126
 27.        105973
 28.         56937
 29.         19541
 30.          2870
 31.            11
WON.btm    2782233
stalemate       24
W check     513505
LEGAL      3298751
TOTAL      3812256
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Makruk

Post by Evert »

hgm wrote:If there is real interest in Makruk I can implement the counting rules in WinBoard. They are not really much different from the 50-move rule. To implement that WinBoard goes back through the game history to the last reversible move, and if that exceeds 100 ply it calls it a draw.In Makruk it would have to scan back to the last capture, and decide from the material after tha capture if it exceeds the max count and is thus draw. If not, it would have to continue scanning to the previous capture and repeat the process, untill it reaches a material composition where no count limit exists.
No rush.

I'd prefer it if they were optional either way, since that's better for general engines.
As to KSNK, according to my asymmetric 4-men generator it is a general win. (This generator does not take into account that KSK has some mate positions, but considers all captures of an unprotected N a draw, so the numbers should be considered pessimistic estimates.)

Code: Select all

        mated    mate
King captures 3493834
mates    1100         ( 0.14 sec)
in-1      556    3124 ( 0.19 sec)
in-2      714    3114 ( 0.23 sec)
in-3     2224    3850 ( 0.30 sec)
in-4     3568   12298 ( 0.34 sec)
in-5     7932   17742 ( 0.41 sec)
in-6    12094   35570 ( 0.45 sec)
in-7    19896   49066 ( 0.52 sec)
in-8    25028   74838 ( 0.59 sec)
in-9    31888   84646 ( 0.67 sec)
in-10   40152  104336 ( 0.75 sec)
in-11   54518  123042 ( 0.83 sec)
in-12   71576  160624 ( 0.92 sec)
in-13  101644  190088 ( 1.03 sec)
in-14  139564  254150 ( 1.16 sec)
in-15  183158  314062 ( 1.30 sec)
in-16  236626  383746 ( 1.47 sec)
in-17  306722  461460 ( 1.66 sec)
in-18  405580  557768 ( 1.88 sec)
in-19  548500  678256 ( 2.14 sec)
in-20  702910  826334 ( 2.47 sec)
in-21  865518  954332 ( 2.84 sec)
in-22 1003754 1057358 ( 3.25 sec)
in-23 1108196 1119422 ( 3.70 sec)
in-24 1139390 1112810 ( 4.19 sec)
in-25 1051018  977282 ( 4.61 sec)
in-26  844270  741134 ( 4.98 sec)
in-27  592726  471760 ( 5.26 sec)
in-28  362544  263038 ( 5.47 sec)
in-29  191122  129664 ( 5.61 sec)
in-30   90460   58746 ( 5.70 sec)
in-31   38162   23832 ( 5.76 sec)
in-32   14138    9522 ( 5.83 sec)
in-33    4822    3596 ( 5.89 sec)
in-34    1720    1324 ( 5.94 sec)
in-35     636     514 ( 6.00 sec)
in-36     174     176 ( 6.05 sec)
in-37      40      44 ( 6.09 sec)
in-38       8      18 ( 6.14 sec)
in-39       0       0 ( 6.20 sec)
won:   14756520 ( 96.8%)
lost:  10204648 ( 66.9%)
avg:       22.2 moves
Annoying. I get 16983926 won positions, with 1120 mate positions.
The asymmetric generator cannot do 5-men, but as S + any single piece is always a win, the only interesting 4+1-men are KNFFK and KFFFK, which are 8-fold symmetric. So these can be calculated with FairyGen, and both are generally won.
Indeed.

I'm a bit surprised by how much stronger the silver general is, compared to the ferz. That extra move makes a huge difference.
My guess would be that when you are ahead in piece material (and none of your Ferzes is doomed) you should be able to prevent opponent promotions, and in the end force trading of the pieces the opponent has left while preserving your Pawns, and then promote the latter. Whether the advantage is winning should then be determined from the color of the Ferzes you would get that way.
If we characterise the phases in orthochess as:
  • Try to get a better position and win material
  • Trade all excess material and promote a pawn
which seems fair (with the aside that if you can play for mate instead, you should), then I have the impression that Makruk follows the phases
  • Try to get a better position and win material
  • Expand your material advantage until it is enough to win (pawns count as ferzes for this purpose)
  • Trade excess material and promote your pawns
which I think is similar to what you said.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Makruk

Post by hgm »

My bitmap-based generator gives exactly the same numbers (but in 410 ms). For the mates the assumption that K x unprotected N is draw should not matter.

K+S can inflict checkmate, and this gives any tandem that contains it a huge advantage. A Gold General already has mating potential by itself, (even upto 14x14 boards), and a Silver is only marginally weaker, just below the threshold. The forward step furthermore breaks the color binding, which is the main thing that makes the Ferz so useless.

As to the phases: I am not sure there really is any real difference with orthodox Chess here. It is more a matter of quantity. The draw margin is much larger compared to the initial material. In absence of strong promotions you are basically always in a 'Pawnless' end-game, where you need about double the advantage as in the presence of strongly-promoting Pawns. And because of the weak promotions the absolte value of Pawns is smaller as well. So expressed in Pawns the draw margin is huge in Makruk.

But in any game you always have to worry about 'staying on schedule' for a win. In Chess you start with 41 (Kaufman values) and must gain 1.5. So when you gain about 11 cP for every minor you trade, you are heading for a win. That means you can usually go for every tiny advantage you see, even when it can only be harvested by trading something. That is very different in Xiangqi, where you start with 51, but the draw margin is ~6. There you cannot afford to trade a Horse or Cannon for a gain smaller than 0.6, or you would be heading for a draw. Makruk is similar to that; you have to worry much more if trading something is worth it.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Makruk

Post by Evert »

hgm wrote:My bitmap-based generator gives exactly the same numbers (but in 410 ms). For the mates the assumption that K x unprotected N is draw should not matter.
Oh, I'm sure mine has a bug somewhere. I already thought of one source of spurious mates: double checks by knight and silver. Only thing is that should give more than the 20 extra mate positions, and since those positions are illegal, they shouldn't propagate either.
K+S can inflict checkmate, and this gives any tandem that contains it a huge advantage. A Gold General already has mating potential by itself, (even upto 14x14 boards), and a Silver is only marginally weaker, just below the threshold. The forward step furthermore breaks the color binding, which is the main thing that makes the Ferz so useless.
Hmm… so that makes me wonder, what is the value difference between an (orthdox) bishop and a bishop with a forward step (so the same difference as between a ferz and a silver)? In particular, how different is that from the bishop pair bonus?

I guess I could easily hack Sjaak and find out for myself, of course...
As to the phases: I am not sure there really is any real difference with orthodox Chess here. It is more a matter of quantity. The draw margin is much larger compared to the initial material. In absence of strong promotions you are basically always in a 'Pawnless' end-game, where you need about double the advantage as in the presence of strongly-promoting Pawns. And because of the weak promotions the absolte value of Pawns is smaller as well. So expressed in Pawns the draw margin is huge in Makruk.
Makes sense. I'll have to think about how to work that in. Currently I'm seeing too many games where an advantage of a knight is made meaningless by careless simplification. Thing is, the score is dropping steadily but slowly at the same time (and completely collapses when it becomes clear that the ending has become a dead draw) so it's not as if the program isn't seeing the problem, it just fails to find an alternative plan.
But in any game you always have to worry about 'staying on schedule' for a win. In Chess you start with 41 (Kaufman values) and must gain 1.5. So when you gain about 11 cP for every minor you trade, you are heading for a win. That means you can usually go for every tiny advantage you see, even when it can only be harvested by trading something. That is very different in Xiangqi, where you start with 51, but the draw margin is ~6. There you cannot afford to trade a Horse or Cannon for a gain smaller than 0.6, or you would be heading for a draw. Makruk is similar to that; you have to worry much more if trading something is worth it.
Would it make sense to treat SEE=0 equal captures (trades) as "bad" unless proven otherwise? In chess I always sort them ahead of the losing captures and I do the same for makruk, but it may not make much sense then...
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Makruk

Post by hgm »

Evert wrote:Oh, I'm sure mine has a bug somewhere. I already thought of one source of spurious mates: double checks by knight and silver. Only thing is that should give more than the 20 extra mate positions, and since those positions are illegal, they shouldn't propagate either.
I can send you a list of all 1100 mate positions I found, if you think that is helpful.
Hmm… so that makes me wonder, what is the value difference between an (orthdox) bishop and a bishop with a forward step (so the same difference as between a ferz and a silver)? In particular, how different is that from the bishop pair bonus?
I tried that once with Fairy-Max, equipping a Bishop either with a single-step backward non-capture (to break color binding) and with a similar capture (to give it mating potential). This did not make a spectacular difference, IIRC the non-capture gave it something like 33 cP. (But of course the B-pair bonus is also only 50 cP.) I used a backward step to minimize the tactical value, and for comparison also looked at the effect of such an extra move on the Knight (where there is no color-binding to break, and the capture would not give it mating potential). There the value increase was about 16 cP. So my conclusion was that the 'overall property' of color binding or mating potential was worth amazingly little.

Now it must be said that Fairy-Max is both stupid in exploiting color binding as well as mating potential. I really should repeat this with Pair-o-Max.
Makes sense. I'll have to think about how to work that in. Currently I'm seeing too many games where an advantage of a knight is made meaningless by careless simplification. Thing is, the score is dropping steadily but slowly at the same time (and completely collapses when it becomes clear that the ending has become a dead draw) so it's not as if the program isn't seeing the problem, it just fails to find an alternative plan.
I guess it depends on the 'trading gradients' you built into your engine. The rule-of-thumb for ortho-Chess is: "When (only) Pawns ahead, trade pieces; when pieces behind, trade Pawns". In Makruk you would have to qualify that by an extra "enough". So it should only encourage trading pieces when you are enough Pawns ahead to be left with a win after everything is traded. Otherwise trading just hastens the draw, and you should probably avoid it. (A Pawn advantage doesn't help you much to increase the advantage, as Pawns are tactically almost useless. But even a 50-50 chance for who will win the next Pawn is to your advantage when you are ahaed in Pawns, but not enough. If you lose one it just stays draw, while if you win one it might be enough to enter the win sector.)

One essential difference with ortho-Chess is that the dynamics "Pawn majority -> passer -> ties up piece to prevent promotion -> tactical superiority of remaining pieces -> gobble up more Pawns" is much less important: promotion gain is only slight, and the weakest piece that can be used to stop a Pawn is much weaker, so a passer doesn't tie up much. In fact it makes little sense to dedicate a Ferz to stopping a passer to promote to Ferz. You might as well let it promote and trade it later. Often you can afford to let it promote, and then simply win it afterwards. So Pawn majorities really offer very little prospective for increasing your lead.

Although Ferz are not spectacularly stronger than Pawns, I guess the difference should increase when you are beind in pieces. Pawns then become a liability, as the cannot run. Ferz much less so. Being a Knight ahead only holds the promise of a victory when the opponent still has enough Pawns to gobble up. (KNPPPKPPP is good, KNFFFKFFF probably a dead draw.) Eventually Pawns of the side with the piece majority (when not traded for opponent Pawns) will be promoted to Ferz, and Pawns of the other side will be eaten. The material eval should take an advance on that outcome, depending on how close you are to that goal (i.e. the bigger your piece advantage is compared to total material).
Would it make sense to treat SEE=0 equal captures (trades) as "bad" unless proven otherwise? In chess I always sort them ahead of the losing captures and I do the same for makruk, but it may not make much sense then...
Sorting should in the end not affect move choice. This should really be controlled by material eval.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Makruk

Post by Evert »

hgm wrote: I can send you a list of all 1100 mate positions I found, if you think that is helpful.
Yes, that probably would be helpful!
I was thinking that I could probably split the list in half (exploiting left/right symmetry), leaving some 500 positions and then go through them by hand in a not-quite random order (positions where the silver is checking the king first), but having a list of positions to toss out will certainly help there!
I tried that once with Fairy-Max, equipping a Bishop either with a single-step backward non-capture (to break color binding) and with a similar capture (to give it mating potential). This did not make a spectacular difference, IIRC the non-capture gave it something like 33 cP. (But of course the B-pair bonus is also only 50 cP.) I used a backward step to minimize the tactical value, and for comparison also looked at the effect of such an extra move on the Knight (where there is no color-binding to break, and the capture would not give it mating potential). There the value increase was about 16 cP. So my conclusion was that the 'overall property' of color binding or mating potential was worth amazingly little.

Did you try a pair of tweaked bishops or a normal bishop+tweaked bishop?
If the dominant effect is the colour-binding, then a pair of normal bishops should be worth approximately the same as a bishop+tweaked bishop, or a pair of tweaked bishops. I would actually expect the difference in piece value to be worth approximately the same as (or perhaps half of) the bishop pair bonus. Your measurement seems to be in that ballpark.

I was thinking whether I could use the difference in value between a ferz and a silver as a rough indication for what a "ferz-pair bonus" might be worth. Can't be the full story of course, since ferz+ferz should not be worth the same as ferz+silver.
I guess it depends on the 'trading gradients' you built into your engine. The rule-of-thumb for ortho-Chess is: "When (only) Pawns ahead, trade pieces; when pieces behind, trade Pawns". In Makruk you would have to qualify that by an extra "enough". So it should only encourage trading pieces when you are enough Pawns ahead to be left with a win after everything is traded. Otherwise trading just hastens the draw, and you should probably avoid it. (A Pawn advantage doesn't help you much to increase the advantage, as Pawns are tactically almost useless. But even a 50-50 chance for who will win the next Pawn is to your advantage when you are ahaed in Pawns, but not enough. If you lose one it just stays draw, while if you win one it might be enough to enter the win sector.)

One essential difference with ortho-Chess is that the dynamics "Pawn majority -> passer -> ties up piece to prevent promotion -> tactical superiority of remaining pieces -> gobble up more Pawns" is much less important: promotion gain is only slight, and the weakest piece that can be used to stop a Pawn is much weaker, so a passer doesn't tie up much. In fact it makes little sense to dedicate a Ferz to stopping a passer to promote to Ferz. You might as well let it promote and trade it later. Often you can afford to let it promote, and then simply win it afterwards. So Pawn majorities really offer very little prospective for increasing your lead.
Yes. I actually don't do any type of pawn evaluation for Makruk at the moment, certainly nothing to score them as better because they're passed. Part of that is because the difference in value between a ferz and a pawn is small enough to begin with, so giving to much of a bonus to a pawn for anything (or a penalty to a ferz) runs the danger of completely wrecking the evaluation.

I guess I'll have to tweak things until it produces something sensible.
Although Ferz are not spectacularly stronger than Pawns, I guess the difference should increase when you are beind in pieces. Pawns then become a liability, as the cannot run. Ferz much less so. Being a Knight ahead only holds the promise of a victory when the opponent still has enough Pawns to gobble up. (KNPPPKPPP is good, KNFFFKFFF probably a dead draw.)
Yes, that's exactly the sort of thing I see happening that needs to be avoided. I'm wondering whether it makes sense to base the "game phase" on the number of remaining pawns, but I haven't played around with that at all yet.
Would it make sense to treat SEE=0 equal captures (trades) as "bad" unless proven otherwise? In chess I always sort them ahead of the losing captures and I do the same for makruk, but it may not make much sense then...
Sorting should in the end not affect move choice. This should really be controlled by material eval.
Sure. Might speed up the search by improving move ordering though, if equal trades are generally bad. Come to think of it, since they would make the game more "draw-ish", whether they're good or bad probably depends on whether you're ahead in material or not, so maybe that should be a factor too.