Shogi plea

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Shogi plea

Post by Ferdy »

Which winboard version is best to run these shogi engines? Currently in my test I use 4.7.2, later I will try 4.7.3a.

I am testing SpearCSA2009v1.5 (USI2WB), and this engine does not exit after a game, perhaps this is because of the old UCI2WB.exe and winboard versions that I am using.

I also tried BonanzaWB, this engine is pretty strong.
I am trying to collect start positions (for my test sets) by playing Shokidoki, Bonanza and Spear at TC 15 min SD.

Last year I built 25 test sets based from games played by strong Japanese players.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Shogi plea

Post by hgm »

The WinBoard version should not matter much; all 4.7.x are just bug-fix versions, and I don't recall there were any Shogi bugs.

Spear is a quite non-compliant engine, however. It does not support all time controls, and gets very strange time usage when you use it at a TC it doesn't support. It also does not announce its hash and ponder options, so that WinBoard does not set its hash-table size and UCI2WB will not set it pondering. Finally, it does not respond to 'isready' when the latter comes during a game, which it will when WinBoard uses ping. The latter is probably the reason why it hangs.

There are work-arounds for all of this, but as I am not playing ponder games, and the default hash size seems to be 128MB, which seems close enough to the 256MB I am using, I did not bother with those. The isready problem is serious, though.

My current engine list looks like this:

Code: Select all

"bonanza.exe" -fd "C:\cygwin\home\shogi\bonanza_v6.0\winbin" -variant shogi
"GNU Shogi" -fcp gnushogi.exe -fd "C:\cygwin\home\gnushogi\gnushogi" -variant shogi
"SPEAR" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\SpearShogidokoro2009" " byoyomi 1000"' -firstFeatures "ping=0" -variant shogi
"LaramieV3.exe" -fd "C:\cygwin\home\shogi\LaramieV3" -fUSI -variant shogi
"Tori.exe" -fd "C:\cygwin\home\shogi" -variant shogi
"SPEAR 9" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=9" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 9"
"SPEAR 8" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=8" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 8"
"SPEAR 7" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=7" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 7"
"SPEAR 6" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=6" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 6"
"SPEAR 5" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=5" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 5"
"SPEAR 4" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=4" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 4"
"SPEAR 3" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=3" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 3"
"SPEAR 2" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=2" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 2"
"SPEAR 1" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\Spear2" " byoyomi 1000"' -firstOptions "SpearLevel=1" -firstFeatures "ping=0" -variant shogi -fn "SPEAR 1"
"TJshogi_WB.exe" -fd "C:\WinBoard\TJ" -variant shogi
"Petit Shogi" -fcp 'UCI2WB.exe debug -s "ssp.exe" C:\WinBoard\PetitShogi " byoyomi 1000"' -fd "C:\WinBoard"
"Leserkai 1.3.6" -fcp 'UCI2WB.exe debug -s "Lesserkai.exe" C:\WinBoard\Lesserkai' -fd "C:\WinBoard" -firstFeatures "ping=0" -variant shogi
"SPEAR2008" -fcp 'UCI2WB debug -s "SpearShogidokoro.exe" "C:\cygwin\home\shogi\SpearShogidokoro2008" " byoyomi 1000"' -firstFeatures "ping=0" -variant shogi
"Shokidoki t/15" -fcp "Tori.exe" -fd "C:\cygwin\home\shogi" -variant shogi -fn "Shokidoki t/15" -firstTimeOdds 15
"TJ odds-15" -fcp "TJshogi_WB.exe" -fd "C:\WinBoard\TJ" -variant shogi -fn "TJshogi t/15" -firstTimeOdds 15
"Laramie odds-15" -fcp "LaramieV3.exe" -fd "C:\cygwin\home\shogi\LaramieV3" -fUSI -variant shogi -fn "Laramie t/15" -firstTimeOdds 15
"Siyam" -fcp "siyam_v0.27.exe" -fd "C:\WinBoard\Siyam" -variant shogi
The -firstFeatures "ping=0" is necessary to let WB think the engine does not support ping, so the isready flaw doesn't wreck things. " byoyomi 1000" (note the leading space!) is needed as a non-compliant suffix in the USI 'go' command (replacing 'winc' and 'binc' parts) to fool Spear in using its time well at 15+0 games, and UCI2WB allows such a hack when you give it as the last argument in its start command.

In principle it is also possible to repair the hash and ponder options: the latest UCI2WB versions support a file "DefectiveEngineOptions.ini" inside the engine folder, which it reads like the engine has printed it as a response to the 'usi' command. So by putting the proper definition of USI_Hash and USI_Ponder in there, UCI2WB will think the engine has these options, and will translate the WB memory command and set the engine pondering when WB requests it.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Shogi plea

Post by Ferdy »

Very good info, I will try your suggestions thank you.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Shogi plea

Post by hgm »

Note that to make the -fUSI work (e.g. with Laramie) I have configured
/uxiAdapter='UCI2WB debug -s "%fcp" "%fd"'
Engines that need extra work-around parameters in the UCI2WB command cannot use the -fUSI, however, and have to spell out the use of UCI2WB explicitly. (And you could leave out the debug parameter; it causes everything the USI engine prints to appear in the winboard.debug.)

BTW, I just saw Siyam lose a game after having been at +65. (OK, Laramie thought it was only at -21.) This in general points to not paying enough attention to King safety.

Code: Select all

[Event "Computer Chess Game"]
[Site "MAKRO-PC"]
[Date "2014.07.25"]
[Round "152"]
[White "Siyam v0.27"]
[Black "Laramie V3 (USI2WB)"]
[Result "0-1"]
[TimeControl "900"]
[Variant "shogi"]
[Annotator "1. +0.00   1... +0.02"]

1. c4 {+0.00/13} g6 {+0.02/9 2.8} 2. Bxh8= {+0.00/10 21} Rxh8 {+0.02/8 3}
3. B@d5 {+2.05/8 24} e6 {-2.48/9 4} 4. Bxb7+ {+2.96/9 32} B@c6 {-2.56/9 4}
5. +Bxc6 {+3.30/10 19} cxc6 {-2.83/9 5} 6. B@d5 {+3.60/8 16} Rb8
{-3.04/9 5} 7. Bxe6 {+4.10/9 19} Rxb3+ {-1.16/9 5} 8. Sc2 {+5.01/9 19} +Rb5
{-1.35/9 6} 9. Bxf7+ {+4.04/9 25} Sg8 {-0.43/9 6} 10. +Bxg6 {+3.05/8 21}
B@b2 {-0.06/10 7} 11. Nc3 {+1.55/9 20} +Rxc4 {+0.23/9 7} 12. P@b6
{-0.85/8 22} Bxa1+ {+2.87/8 8} 13. b7+ {+4.75/7 16} L@e8 {-0.03/8 8} 14.
P@b8 {+7.55/6 15} P@g7 {-1.71/8 9} 15. +Bi4 {+14.40/7 15} +Rxc3 {-4.99/8 9}
16. Sxc3 {+20.62/7 15} +Bxc3 {-7.14/7 10} 17. Gd2 {+26.58/7 14} +Bb4
{-4.25/7 10} 18. bxb9+ {+26.82/6 14} N@c4 {-6.98/7 11} 19. +Pxc9
{+26.47/6 14} Nxd2+ {-7.03/7 11} 20. Rxd2 {+29.04/6 13} Gxc9 {-8.53/7 12}
21. R@c7 {+27.13/5 13} S@d8 {-8.60/7 12} 22. Rxc6+ {+26.59/6 13} G@c3
{-9.06/7 13} 23. Ri2 {+24.89/6 12} Lxe3+ {-3.56/7 13} 24. Gf2 {+24.13/6 12}
Gxd3 {-5.33/7 14} 25. Kf1 {+22.98/7 12} +Lxf2 {-5.36/6 14} 26. Sxf2
{+23.38/6 11} P@e3 {-5.13/6 14} 27. P@e1 {+24.67/5 11} G@d6 {-6.91/7 14}
28. L@e4 {+24.83/5 11} Kf8 {-6.07/7 14} 29. S@e7 {+21.78/5 11} Kg9
{-9.53/10 14} 30. Sxd6= {+23.85/8 12} +Bxd6 {-11.29/9 14} 31. +Rc4
{+25.40/8 10} S@c2 {-12.03/8 14} 32. Le8+ {+31.55/7 10} P@c5 {-13.29/7 14}
33. +Re4 {+32.74/6 9} P@b2 {-15.05/7 14} 34. P@c8 {+39.75/6 9} Gb9
{-18.75/8 14} 35. +Lxd8 {+47.83/7 9} +Bc6 {-19.29/8 14} 36. +Re7
{+41.83/6 9} +Bd6 {-20.28/8 14} 37. +Rxd6 {+51.23/7 9} dxd6 {-20.48/8 14}
38. c9+ {+51.28/6 8} R@d1 {-19.12/8 14} 39. Kg2 {+51.60/5 8} e2+
{-21.21/8 14} 40. exe2 {+50.65/6 8} Gxe2 {-20.63/8 14} 41. B@e7
{+51.05/5 8} Kh8 {-19.66/8 14} 42. S@e1 {+46.88/5 8} Gxe1 {-19.91/9 14} 43.
Bf6+ {+51.28/6 7} Ki8 {-22.00/8 14} 44. +Pxb9 {+60.60/6 7} S@f7
{-22.00/8 14} 45. +Bf5 {+64.25/6 7} Ge2 {-21.74/8 14} 46. G@g1 {+64.95/5 7}
Rd2+ {-21.52/8 14} 47. P@d1 {+63.15/6 7} Sxd1= {-18.06/8 14} 48. N@h6
{+63.05/6 6} Kh8 {-18.41/3} 49. Nxg8+ {+61.40/6 6} Gxg8 {-17.96/8 15} 50.
+Pxa9 {+61.52/5 6} Gxf2 {-17.93/8 15} 51. Gxf2 {+63.32/6 6} S@e1
{-16.94/8 15} 52. S@g1 {+61.01/5 6} Se2+ {-15.43/8 15} 53. L@f1
{+60.25/5 6} Sxf2+ {-13.98/8 15} 54. Lxf2 {+53.48/6 6} G@f1 {-6.91/8 15}
55. Kh2 {+50.66/5 5} +Sxf2 {+2.80/7 15} 56. P@d1 {+52.77/4 5} Gxg1
{+7.29/8 15} 57. h4 {+21.27/6 5} +Rxd1 {+9.53/7 15} 58. N@g5 {+21.32/5 5}
S@g2 {+19.37/7 15} 59. S@g9 {+18.30/5 5} Kxg9 {+11.39/3} 60. Nxf7=
{+21.28/5 5} Kh8 {+15.06/3} 61. +Bxg2 {-12.90/6 5} Gxg2 {+24.52/6 17} 62.
Kh3 {-18.28/3} N@h6 {+24.96/6 17} 63. G@h2 {+1.98/4 5} Gxh2 {+1000.03/1}
64. Rxh2 {-299.90/6 4} B@g2 {+1000.05/1} 65. Ki2 {-299.92/7 4} Bxh1+
{+1000.09/1} 66. Rxh1 {-299.94/6 4} +Rxh1 {+1000.04/1} 67. Kxh1 {+25.99/2}
G@g2 {+1000.02/1} 68. Ki2 {-299.98/2} R@h2# {+1000.01/1}
{Xboard adjudication: Checkmate} 0-1
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Shogi plea

Post by Ferdy »

hgm wrote:Note that to make the -fUSI work (e.g. with Laramie) I have configured
/uxiAdapter='UCI2WB debug -s "%fcp" "%fd"'
Engines that need extra work-around parameters in the UCI2WB command cannot use the -fUSI, however, and have to spell out the use of UCI2WB explicitly. (And you could leave out the debug parameter; it causes everything the USI engine prints to appear in the winboard.debug.)

BTW, I just saw Siyam lose a game after having been at +65. (OK, Laramie thought it was only at -21.) This in general points to not paying enough attention to King safety.
This is the line that I use for Laramie. I also remove the "debug".

Code: Select all

"UCI2WB -s LaramieV3.exe LaramieV3" -fd "C:\engines\Shogi\LaramieV3"
Siyam is really not polished yet. I spent more time to Lima (shogi 5x5) than on Siyam, I will look what I have in the eval.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Shogi plea

Post by hgm »

Code: Select all

"UCI2WB -s LaramieV3.exe LaramieV3" -fd "C:\engines\Shogi\LaramieV3"
This is a bit suspect:

As far as WinBoard is concerned, the engine is UCI2WB, and you tell to WinBoard with the -fd option to look for it in C:\engines\Shogi\LaramieV3, which would also be the folder from where UCI2WB.exe would start to look for its files. But you tell UCI2WB then that it should for LaramieV3.exe in LaramieV3, which would then be

C:\engines\Shogi\LaramieV3\LaramieV3\LaramieV3.exe

which seems to contain an extra level of LaramieV3 folders, while there should exist a

C:\engines\Shogi\LaramieV3\UCI2WB.exe

Normally I use the UCI2WB.exe in the WinBoard folder (so that it is not needed to specify an -fd), and tell UCI2WB in its last argument then how to find the folder containing the engine.exe from the WinBoard folder (or absolutely).

As to strategy: I never played Shogi, but I noticed that the stronger engines relentlessly attack the King fortress, even if they have to give up material to do that, and no mate is within the horizon. Shokidoki gained a lot of strength when I let its King-safety term award having attacking pieces two steps away from the King, and especially having that on both sides. It is a strategic mistake to go for more material rather than go for the King, because even with the little material the opponent has left, he might still be able to checkmate you, when he concentrates it against your King. Defending seems more difficult than attacking in Shogi, so attack is the best defense, and it is really a 'race to mate'.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Shogi plea

Post by hgm »

I added Siyam to my course Elo determination. The t/15 engines were using 1-min in stead of 15-min sudden-death. They seem about 400 Elo weaker than their un-handicapped versions (except Laramie, which loses less.) That is about 100 Elo per TC doubling.

Code: Select all

Rank Name                        Elo    +    - games score oppo. draws
   1 SpearCSA2009v1.5 (USI2WB)  2119  103  103   200   93%  1417    1%
   2 SPEAR 9                    2001   86   86   200   88%  1422    1%
   3 SPEAR 8                    1930   80   80   200   85%  1426    3%
   4 Shokidoki tori             1925   80   80   200   84%  1426    1%
   5 SPEAR 7                    1883   78   78   200   81%  1428    0%
   6 SPEAR 6                    1700   71   71   200   69%  1438    1%
   7 Laramie V3 (USI2WB)        1687   70   70   199   68%  1442    1%
   8 TJshogi 0.10               1629   69   69   200   63%  1441    1%
   9 SPEAR 5                    1527   67   67   200   56%  1446    2%
  10 Shokidoki t/15             1498   67   67   200   53%  1448    1%
  11 ssp (USI2WB)               1426   66   66   200   47%  1451    2%
  12 NebiyuAlien_1.43           1425   67   67   200   47%  1451    0%
  13 Laramie t/15               1337   68   68   196   39%  1470    0%
  14 SPEAR 4                    1305   68   68   200   37%  1457    2%
  15 SPEAR 3                    1266   69   69   200   34%  1459    4%
  16 Siyam v0.27                1262   70   70   200   34%  1459    2%
  17 TJshogi t/15               1239   72   72   200   33%  1461    0%
  18 SPEAR 2                     921   93   93   200   14%  1476    0%
  19 SPEAR 1                     917   91   91   200   14%  1477    2%
  20 GNU Shogi 1.4.0p0           728  113  113   195    6%  1488    1%
  21 Lesserkai 1.3.6 (USI2WB)    723  112  112   200    6%  1486    2%
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Shogi plea

Post by hgm »

I now have posted the full cross table and games PGN on my website.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Shogi plea

Post by Ferdy »

hgm wrote:

Code: Select all

"UCI2WB -s LaramieV3.exe LaramieV3" -fd "C:\engines\Shogi\LaramieV3"
This is a bit suspect:

As far as WinBoard is concerned, the engine is UCI2WB, and you tell to WinBoard with the -fd option to look for it in C:\engines\Shogi\LaramieV3, which would also be the folder from where UCI2WB.exe would start to look for its files. But you tell UCI2WB then that it should for LaramieV3.exe in LaramieV3, which would then be

C:\engines\Shogi\LaramieV3\LaramieV3\LaramieV3.exe

which seems to contain an extra level of LaramieV3 folders, while there should exist a

C:\engines\Shogi\LaramieV3\UCI2WB.exe

Normally I use the UCI2WB.exe in the WinBoard folder (so that it is not needed to specify an -fd), and tell UCI2WB in its last argument then how to find the folder containing the engine.exe from the WinBoard folder (or absolutely).
The one you suggested below does not work, of course I change the path to the file. It seems to load because the engine name is displayed in the winboard window but it does not move when you attempt to play with it.

Code: Select all

"Laramie odds-15" -fcp "LaramieV3.exe" -fd "C:\cygwin\home\shogi\LaramieV3" -fUSI -variant shogi -fn "Laramie t/15" -firstTimeOdds 15
However the one I posted had already played a game. The file UCI2WB is in the winboard installation directory.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Shogi plea

Post by hgm »

Then perhaps your /uxiAdapter option is not set for Shogi. -fUSI invokes this adapter, by replacing the engine command by the uxiAdapter string (and ignoring any -fd), where in that string it again replaces any %xxx by the value of WB string option -xxx. So the uxiAdapter string should be set to

UCI2WB -s "%fcp" "%fd"

to call UCI2WB with the engine.exe and engine folder as parameters (as UCI2WB likes it). It could still be set for UCCI Xiangqi engines.