Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by maksimKorzh »

Hello Mr. Muller

I have a few questions:
1. Where can I download winboard/xboard to support jiangqi (not xiangqi!)?
2. Is there any code snippet showcasing the bare minimum windboard/xboard CECP protocol?
3. Any chance to get linux executable of jiangi engine you're now developing?

Thanks in advance!

P.S. Got familiar with the game a couple of days ago, wanna play around with it)
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by hgm »

The WinBoard beta version at http://hgm.nubati.net/WinBoard-AA.zip supports Janggi.

There is a tutotial about WB protocol at the WB forum ( http://www.open-aurec.com/wbforum/viewt ... 24&t=51739 ).

The first version of the engine without any known bugs can be downloaded from http://hgm.nubati.net/j4.exe .
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by maksimKorzh »

hgm wrote: Thu Mar 25, 2021 7:42 pm The WinBoard beta version at http://hgm.nubati.net/WinBoard-AA.zip supports Janggi.

There is a tutotial about WB protocol at the WB forum ( http://www.open-aurec.com/wbforum/viewt ... 24&t=51739 ).

The first version of the engine without any known bugs can be downloaded from http://hgm.nubati.net/j4.exe .
Just awesome!
Thank you!
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by maksimKorzh »

hgm wrote: Thu Mar 25, 2021 7:42 pm The WinBoard beta version at http://hgm.nubati.net/WinBoard-AA.zip supports Janggi.

There is a tutotial about WB protocol at the WB forum ( http://www.open-aurec.com/wbforum/viewt ... 24&t=51739 ).

The first version of the engine without any known bugs can be downloaded from http://hgm.nubati.net/j4.exe .
To select jiangi variant I choose "edit games" on winboard startup
Then install engine, engine starts searching and makes the first move for white, however
when engine is playing with black pieces gui gives "illegal move" error, here's the engine's log:

Code: Select all

dep	score	nodes	time	(not shown:  tbhits	knps	seldep)
  9	+0.03 	3.36M  	0:04.10	c9d7 f0f1 b7e7 b2e2 h9g7 h0g2 c6d6 h2f2 h7f7
  8	 -0.14 	1.22M  	0:01.53	c9d7 f0f1 b7e7 b2e2 e7e9 e2e0 d7e5 h0g2
  7	 -0.14 	279092	0:00.36	c9d7 f0f1 h7c7 b2e2 c7e7 e2e4 e7e5
  6	 -0.33 	39600  	0:00.05	c9d7 b2e2 h7c7 a0b0 c7e7 e2e4
  5	+0.03 	15864  	0:00.02	c9d7 b2e2 b7e7 e2e4 e7e5
  4	 -0.32 	1202    	0:00.00	c9d7 b2e2 b7e7 e2e4
  3	+0.03 	502      	0:00.00	c9d7 b2e2 b7e7
  2	 -1.04 	9          	0:00.00	c9d7 b2e2
  1	+0.03 	4          	0:00.00	c9d7Ȁ`ȁV
I tried to play vs engine (mode: Machine playing black)
Same stuff if the engine is loaded as engine1 and engine2 (mode: engine vs engine)

What am I doing wrong?
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by maksimKorzh »

Actually it feels like illegal move occurs every time a bishop is trying to move like a knight from it's starting place.
I heard jiangi rules allow to swap bishop and knight before the game starts, so it feels like engine's internal position has swapped knight and bishop
while GUI's board still has them on initial places.

Anyway I've managed to play as black without issues, when engine is playing white this issue doesn't seem to occur.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by maksimKorzh »

It seems like I was right...
Here's the line from winboard.debug:

Code: Select all

1637 <first : setup (PH.R.AE..K.C.ph.r.ae..k.c.) 9x10+0_janggi reha1aehr/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RHEA1AEHR w 0 1
Note in fen for black elephant(bishop) and horse are swapped while for white they are not swapped.

EDIT: Solved by manually updating (editing) position in GUI, this has resulted engine's position to get updated properly, now it looks like this:

Code: Select all

283529 >first : setboard rhea1aehr/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RHEA1AEHR w 0 1
EditPosDone
Now it works like a charm!
Thank you so much for providing winboard supporting jiangi and your engine!

P.S. Will jianggi be available in xboard? (I just still can't get whether you maintain them simultaneously or xboard is maintained by someone else)
It's not an official release of winboard right?

EDIT2:
Just played a game between J 0.2b and Fairy Stockfish

[Event "Computer Chess Game"]
[Site "maksim-Inspiron"]
[Date "2021.03.25"]
[Round "-"]
[White "J 0.2b"]
[Black "Fairy-Stockfish 11.2 LB 64"]
[Result "0-1"]
[TimeControl "40/300"]
[Variant "janggi"]
[Annotator "1. +0.14 1... +0.32"]

1. Hc2 {+0.14/9} ih6 {+0.32/20 17} 2. Ce2 {+0.11/8 5} Hg7 {+0.48/16 3} 3.
c4 {+0.93/7 3} Ke9 {+0.81/17 5} 4. Hg2 {+0.54/7 4} Ade8 {+0.79/18 10} 5.
Hb4 {+0.42/7 4} ab6 {+1.17/14 2.9} 6. Ce0 {+0.34/8 9} Ra5 {+2.42/15 5} 7.
g4 {+0.22/7 4} Rh5 {+3.35/14 1.8} 8. Ca2 {+0.01/6 4} Rh1+ {+4.80/14 2.7} 9.
Af1 {-1.71/9 13} Rg1 {+4.54/15 2.6} 10. Ca9 {-1.84/8 9} Rxg2 {+6.19/15 7}
11. Cxc9 {-2.70/8 12} Ch1+ {+7.82/16 2.2} 12. Kf0 {-2.19/7 3} Ci7
{+10.29/18 3} 13. Rh0 {-2.21/8 8} Cf7+ {+10.67/18 5} 14. Ae1 {-2.34/8 6}
Rf2+ {+10.82/18 2.6} 15. Af1 {-2.32/8 8} Ri2+ {+10.89/20 11} 16. Ae1
{-1.74/8 3} Ch8 {+11.35/19 10} 17. ih3 {-3.36/8 10} Rf2+ {+17.66/19 2.4}
18. Af1 {-3.37/8 10} Cxf1 {+16.87/20 5} 19. Ae1 {-3.29/7 5} Cf6+
{+1000.07/30 2.3} 20. Af1 {-3.41/8 11} Ri1 {+1000.06/38 2.4} 21. Cxe6+
{-6.51/8 7} Exe6 {+1000.04/118 2.2} 22. Ke0 {-6.57/8 4} Rixf1
{+1000.03/179 2.2} 23. Ca9+ {-1000.02/8 7} Hd8 {+1000.02/245 1.2} 24. Exf2
{-1000.01/8 4} Rf0# {+1000.01/245 1.2}
{Xboard adjudication: Checkmate} 0-1

All works well, no errors.
I love J 0.2b, despite the fact it's search is much shallower the eval is really interesting,
does it already use some reinforcement learning you've been describing in the dedicated thread?
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Jinagi, winboard/xboard gui & minimalist CECP: questions to HGM

Post by hgm »

Ah yes, I forgot to mention that. You have to switch WinBoard's legality testing off, to make it accept the initial position indicated by the engine. In Janggi the players can choose the start location of their Horses and Elephants, and I implemented this by having the engine randomize it. This usually leads to the engine starting from a different position than the 'nominal' one, which would bring the GUI and engine 'out of phase' if WinBoard doesn't accept the engines alternative position.

The alternative is to start from a setup positon, e.g. by pasting a FEN into WinBoard. This forces bot WinBoard and the engine to that position. Korean players use a .fen file with the 10 possible starting positions, which seem to have a standard number, and always start the game by loading the position they want to play from (using the Load Position menu).