Of course this can be easily prevented by adding the knowledge of what is the wrong corner for this specific end-game. Fairy-Max is intended to be a general, configurable variant engine, though, and in other end-games with color-bound unorthodox pieces, it would be really hard to know what is the 'wrong corner'.
I found an alternative, extremely simple approach, which seems to work. In Fairy-Max all light pieces + King have the same PST, which values a corner about 24cP below the center. I recently added code to detect a bare King in the root, and multiply its PST contribution by 5 in that case. (Each piece type already had its own 'PST weight', which was set to 0 or 1, and I just up that to 5.) That does greatly help driving a bare King into a corner with many light and super-light pieces. But it does not solve the wrong-corner problem.
So what I do now is that a move of a bare King at game level increases the PST value at its to-square by 5cP (so with weight 5 that is 25cP). Once it has been at a square, it likes to return there. If it has been there several times, it loves to return there. And of course the all-powerful opponent then tries to prevent that.
Code: Select all
if(pstWeight[piece] == 5) PST[toSqr] += 5;
With this simple modification, it managed to effect a KBNK mate in 40 moves in self-play at 40/10'
[d]8/8/8/8/4k3/8/8/KNB5 w - - 0 1
[pgn][Event "Computer Chess Game"]
[Site "hgm-xboard"]
[Date "2014.10.11"]
[Round "-"]
[White "Fairy-Max 4.8T"]
[Black "Fairy-Max 4.8T"]
[Result "1-0"]
[TimeControl "40/600"]
[FEN "8/8/8/8/4k3/8/8/KNB5 w - - 0 1"]
[SetUp "1"]
1. Kb2 {+6.39/19} Kd4 {-6.23/18 10} 2. Kc2 {+6.60/19 14} Ke4 {-6.45/19 12}
3. Nc3+ {+6.77/19 15} Kf5 {-6.55/18 11} 4. Kd3 {+6.77/18 9} Ke5
{-6.55/18 10} 5. Ne2 {+6.75/18 10} Kf5 {-6.61/18 13} 6. Bf4 {+6.82/18 13}
Kg6 {-6.72/18 8} 7. Ke4 {+6.79/18 17} Kf6 {-6.64/18 10} 8. Be5+
{+6.76/18 20} Ke6 {-6.63/18 14} 9. Nf4+ {+6.74/17 9} Kd7 {-6.59/17 9} 10.
Kd5 {+6.71/17 14} Ke7 {-6.60/18 16} 11. Kc6 {+6.77/18 15} Kd8 {-6.69/19 19}
12. Bf6+ {+6.92/18 10} Kc8 {-6.72/18 8} 13. Nd5 {+6.91/19 16} Kb8
{-6.71/19 8} 14. Nb6 {+6.88/19 16} Ka7 {-6.70/20 9} 15. Nd7 {+6.85/19 12}
Ka6 {-6.69/20 12} 16. Bd8 {+6.82/19 16} Ka7 {-6.68/21 13} 17. Bb6+
{+6.83/19 8} Ka8 {-6.68/21 9} 18. Nf6 {+6.82/19 7} Kb8 {-6.67/21 17} 19.
Bc5 {+6.79/19 19} Kc8 {-6.66/19 13} 20. Bd6 {+6.88/19 14} Kd8 {-6.65/20 12}
21. Nd5 {+6.87/19 10} Kc8 {-6.68/20 13} 22. Be5 {+6.90/19 11} Kd8
{-6.69/20 26} 23. Bf4 {+6.91/19 13} Kc8 {-6.89/20 9} 24. Ne7+
{+79.73/20 12} Kd8 {-6.98/21 11} 25. Kd6 {+79.80/20 9} Ke8 {-79.78/21 20}
26. Bh6 {+79.82/20 15} Kf7 {-79.88/21 8} 27. Bg5 {+79.87/20 10} Ke8
{-79.89/21 10} 28. Kc7 {+79.87/20 13} Kf8 {-79.88/22 18} 29. Kd8
{+79.88/21 8} Kf7 {-79.89/23 17} 30. Kd7 {+79.87/21 10} Kf8 {-79.90/23 18}
31. Ke6 {+79.90/21 10} Kg7 {-79.91/21 10} 32. Be3 {+79.91/20 8} Kf8
{-79.92/21 15} 33. Nf5 {+79.92/20 11} Ke8 {-79.93/21 12} 34. Bg5
{+79.93/20 8} Kf8 {-79.94/25 8} 35. Be7+ {+79.94/24 9} Kg8 {-79.95/28 1.5}
36. Kf6 {+79.95/28 2.0} Kh7 {-79.96/28 0.2} 37. Kf7 {+79.96/28 0.1} Kh8
{-79.97/28 0.1} 38. Kg6 {+79.97/28} Kg8 {-79.98/28} 39. Nh6+ {+79.98/28}
Kh8 {-79.99/28} 40. Bf6# {+79.99/28}
{White mates} 1-0[/pgn]
