I realized stage 1 of this project: a toy engine that plays Janggi. It is still very basic (e.g. no hash table yet), but it plays. And to my inexperienced eyes the moves don't look too crazy, so I hope most bugs are gone now. (First I had a tremendous search explosion in QS, because I had forgotten to define the move list as unsigned, so that the MVV/LVA sorting worked the wrong way around!
) I uploaded the engine to http://hgm.nubati.net/j2.exe
; it can be played in the latest WinBoard-AA version, which supports Janggi as a standard variant.
I spent most time on thinking how I would handle the evaluation. Janggi is much like Team-Mate Chess: no single piece has mating potential, even KRK is insufficient mating material. Pairs of pieces can only force mate against a bare King when they contain a Pawn or Rook. So where in Chess you can get away with not knowing KBK and KNK are draws, because you won't fall into that trap that often, in Jianggi not recognizing the dead draws would mean you will draw virtually every game, even those where you have a 3-piece advantage. (Which would be enough against a bare King, but cannot beat an opponent still has Advisors in the Palace. So the evaluation determines for all combinations of 3 or fewer pieces how much of a Palace it can beat (KAA, KA, bare K or not at all), and whether the defender does have enough, or even too many Advisors to survive.
I both players still have enough material to overwhelm the enemy Palace, I do a 'normal' evaluation, based on piece values and PST. The assumption here is that it doesn't hurt in this case that the Advisors can not reach the opponent Palace to attack, as I would need to assign some pieces to the defense of the Palace anyway, and I might as well assign that task to the Advisors, so that my other material is free to attack. This way the Advisors indirectly contribute to the attack power just as every other piece.
The situation becomes different when one of the players can no longer overwhelm the enemy Palace. The opponent can then throw all his remaining material against the Palace of that player, except of course his Advisors. So Advisors in excess of what was needed to defend become worthless for that attacking player. E.g. if I only have a Rook, and the opponent still has a KAA Palace, both his Advisors are completely useless, as the Rook cannot even checkmate a bare King. (And perpetually checking it would be forbidden as well.) Losing the value of his redundant Advisors is a disadvantage for the attacker, but this is often more than compensated by the fact that the defender's Pawns become mostly useless: they are almost always too far in front of the Palace to help in the defense, and the attacker simply goes around and behind them. Only a pair of Pawns on the initial rank directly in front of the Palace (protecting each other) can be a hindrance for attacking Elephants. So the evaluation ignores the defender's Pawns and the attacker's redundant Advisors. Of course when both players lack the material to overwhelm each other's Palace, the game is a dead draw.
I hope this method of evaluation captures the essence of the game; in the future it can be made more elaborate by also tabulating the material needed to overcome Palace + one other piece.
Next step would be to use this engine in self-play to generate games, and in particular quiet positions from these games, to serve as learning material to Texel-tune the evaluation. (Which currently operates based on guessed piece values and other parameters.)