I uploaded the Windows binary of a simple engine that can play Janggi (Korean Chess) to http://hgm.nubati.net/j3.exe . It can play under the WinBoard beta version (in the WinBoard-AA package), which supports Janggi as a standard variant.
The engine is still very basic; it doesn't even have a hash table yet. I focused mainly on determining what the most basic evaluation patterns for Janggi are, and implementing those. They are not tuned yet, though, so although they now have weights that encourage and discourage the things the should, they might do it by a completely wrong amount. But it plays.
Janggi toy engine released
Moderators: hgm, Dann Corbit, Harvey Williamson
-
hgm
- Posts: 27701
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
-
Ferdy
- Posts: 4833
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: Janggi toy engine released
Are these features implemented?
Code: Select all
feature option="Evaluate piece mobility -check 0"
feature option="Evaluate trapped pieces -check 0"
feature option="Evaluate drawish material -check 1"
feature option="Evaluate specific endings -check 1"
feature option="Evaluate pawn structure -check 1"
feature option="Evaluate king shelter -check 1"
feature option="Evaluate king seige -check 0"-
hgm
- Posts: 27701
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Janggi toy engine released
No. They are a remnant from KingSlayer, from which I took the protocol driver. I did not bother to delete these option features, though, because in the future this engine might really have them too. Definitely mobility, Pawn structure and King seige. One could argue that drawishness is already in there (but currently always enabled).
This latest version has PST evaluation (tapered, where Horse & Pawn value go up and Cannon value goes down towards the end-game), a penalty for Cannons on enemy territory that have no move to retreat backwards, a penalty for two Cannons in the same rank, proper discouragement / encouragement of equal trading, and recognition of some elementary drawn end-games.
This latest version has PST evaluation (tapered, where Horse & Pawn value go up and Cannon value goes down towards the end-game), a penalty for Cannons on enemy territory that have no move to retreat backwards, a penalty for two Cannons in the same rank, proper discouragement / encouragement of equal trading, and recognition of some elementary drawn end-games.
-
hgm
- Posts: 27701
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Janggi toy engine released
I am running a match against the previous version now, (which did not have the Cannon terms, trading gradient, and had a Rook PST which erroneously awarded Rooks for being on Palace files), and after 50 games it is leading by 63% (27+, 14-, 9=), which would mean nearly +100 Elo. I think it is especially the Cannon-retreat term that helps, as the old version loses a Cannon quite often. Also, the new version obviously is smarter in dumping its Cannons in the late end-game. This is despite the fact that I put (for the purpose of this match) a significant random perturbation on the score of the first 6 moves in the new version, so that it often plays moves that it would consider sub-optimal. Which in theory should disadvantage it.
-
hgm
- Posts: 27701
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Janggi toy engine released
Oops, the version I uploaded earlier had a move bug (for Rooks in the center of the Black Palace the forward range was only 1). I uploaded a corrected version to the same URL now.
-
lkaufman
- Posts: 5942
- Joined: Sun Jan 10, 2010 6:15 am
- Location: Maryland USA
Re: Janggi toy engine released
I have read that in tournaments there are no draws in Janggi because if a game would be drawn they count material points, and if the first player is ahead by 2 or more points he wins, otherwise he loses. You might make this an option in your engine.hgm wrote: ↑Fri Feb 19, 2021 12:18 pm I uploaded the Windows binary of a simple engine that can play Janggi (Korean Chess) to http://hgm.nubati.net/j3.exe . It can play under the WinBoard beta version (in the WinBoard-AA package), which supports Janggi as a standard variant.
The engine is still very basic; it doesn't even have a hash table yet. I focused mainly on determining what the most basic evaluation patterns for Janggi are, and implementing those. They are not tuned yet, though, so although they now have weights that encourage and discourage the things the should, they might do it by a completely wrong amount. But it plays.
Komodo rules!
-
hgm
- Posts: 27701
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Janggi toy engine released
Indeed, there are several 'rule flavors' of Janggi, and some of those use material counting as a tie breaker for draws, to award 'partial wins' or 'partial losses'. Another aspect in which rules differ is King facing ('BikJang'), which is not forbidden like in Xiangqi, but counts as the active King checking the passive King (but not the other way around!), accompanied with a draw offer. And then repetition rules vary as to whether you would be allowed to do that perpetually.
The engine should allow specifying such rule variations. The logical method would be to do this through options. But Fairy-Stockfish, which also can play Janggi, uses 4 different variant names for the variaous rule combination. The rules used by the current engine (no material counting, King facing ignored) correspond closest to what Fairy-Stockfish calls 'janggicasual' (but under the name 'janggi').
The engine should allow specifying such rule variations. The logical method would be to do this through options. But Fairy-Stockfish, which also can play Janggi, uses 4 different variant names for the variaous rule combination. The rules used by the current engine (no material counting, King facing ignored) correspond closest to what Fairy-Stockfish calls 'janggicasual' (but under the name 'janggi').