Sjaak II 1.4.1 and Shogi

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II 1.4.1 and Shogi

Post by hgm »

Evert wrote:Are you sure the working directory is the one that holds variants.txt? I remember his being tricky when starting programs in Windows.
Sure. I started it from the command line, in the directory where everything is:
C:\WinBoard-4.8.0\SjaakIIc>dir
Volume in drive C is OS
Volume Serial Number is C4E8-1103

Directory of C:\WinBoard-4.8.0\SjaakIIc

12/12/2016 09:29 PM <DIR> .
12/12/2016 09:29 PM <DIR> ..
11/19/2014 05:43 PM 35,147 COPYING
12/12/2016 09:29 PM <DIR> misc
01/29/2015 09:05 AM 4,160 README
11/29/2016 05:03 PM 1,549,824 SjaakII_win32_MS.exe
11/29/2016 05:03 PM 1,564,160 SjaakII_win64_MS.exe
11/21/2016 05:13 PM 82,902 variants.txt
5 File(s) 3,236,193 bytes
3 Dir(s) 32,313,782,272 bytes free

C:\WinBoard-4.8.0\SjaakIIc>SjaakII_win64_MS.exe
Sjaak II version 1.4.1 (x86_64)
Type 'help' for a list of commands and help topics
8r n b q k b n r
7p p p p p p p p
6
5
4
3
2P P P P P P P P
1R N B Q K B N R *
a b c d e f g h
#[Chess] 0w>xboard

protover 2
feature setboard=1 time=1 sigint=0 colors=0 highlight=1 ping=1 memory=1 analyze=
1 pause=1 nps=1 sjef=1 myname="Sjaak II 1.4.1" myversion="[1.4.1 (x86_64)]" vari
ants="seirawan,shatar,makruk,shatranj,sittuyin,crazyhouse,chessgi,asean,ai-wok,s
uper,spartan,pocketknight,kingofthehill,knightmate,berolina,losalamos,micro,capa
blanca,gothic,embassy,greatshatranj,courier,grand,opulent,omega,minishogi,shosho
gi,shogi,torishogi,xiangqi,chess960,fischerandom,fischerrandom,nocastle,wildcast
le,great,caparandom,minisho,5x5+5_shogi,tori,7x7+6_shogi,sho,9x9+0_shogi,king-of
-the-hill,fairy,8x8+0_fairy,8x8+6_fairy,8x8+1_fairy,6x6+0_fairy,5x5+0_fairy,10x8
+0_fairy,12x8+0_fairy,10x10+0_fairy,12x12+0_fairy,5x5+5_fairy,9x9+0_fairy,9x9+8_
fairy,7x7+6_fairy,9x10+0_fairy,normal"
feature option="Variant fairy selects -combo chess (8x8+0) /// seirawan (8x8+0)
/// shatar (8x8+0) /// makruk (8x8+0) /// shatranj (8x8+0) /// sittuyin (8x8+6)
/// crazyhouse (8x8+6) /// chessgi (8x8+6) /// asean (8x8+0) /// ai-wok (8x8+0)
/// super (8x8+0) /// spartan (8x8+0) /// pocketknight (8x8+1) /// kingofthehill
(8x8+0) /// knightmate (8x8+0) /// berolina (8x8+0) /// losalamos (6x6+0) /// m
icro (5x5+0) /// capablanca (10x8+0) /// gothic (10x8+0) /// embassy (10x8+0) //
/ greatshatranj (10x8+0) /// courier (12x8+0) /// grand (10x10+0) /// opulent (1
0x10+0) /// omega (12x12+0) /// minishogi (5x5+5) /// shoshogi (9x9+0) /// shogi
(9x9+8) /// torishogi (7x7+6) /// xiangqi (9x10+0) /// chess960 (= chess) /// f
ischerandom (= chess) /// fischerrandom (= chess) /// nocastle (= chess) /// wil
dcastle (= chess) /// great (= greatshatranj) /// caparandom (= capablanca) ///
minisho (= minishogi) /// 5x5+5_shogi (= minishogi) /// tori (= torishogi) /// 7
x7+6_shogi (= torishogi) /// sho (= shoshogi) /// 9x9+0_shogi (= shoshogi) /// k
ing-of-the-hill (= kingofthehill)"
feature option="Mate search -combo Disabled /// *Enabled for drop games /// Enab
led"
feature option="Level -combo Clueless /// Random /// Static /// *Normal"
feature option="MultiPV -spin 1 1 256"
feature option="Draw offer threshold -spin 0 0 1000"
feature option="Moves before draw offer (0 to disable) -spin 0 0 1000"
feature option="Resign threshold -spin 500 100 16000"
feature option="Moves before resigning (0 to disable) -spin 0 0 1000"
feature option="Randomise opening moves -spin 10 0 40"
feature option="Random amplitude (0 to disable) -spin 20 0 100"
feature option="Send 'piece' descriptions -check 1"
feature option="Mark holes in board -check 1"
feature option="List user-defined variants before buildin variants -check 1"
feature option="Report fail low -check 0"
feature option="Report fail high -check 0"
feature option="Claim repetitions -check 1"
feature option="Send O-O/O-O-O for castling -check 1"
feature option="Remember evaluation parameter file -check 0"
feature option="Variant 'normal' is -string chess"
feature option="Set variant alias -string "
feature option="Variant configuration file -file "
feature option="Evaluation parameter file -file "
feature done=1
I think this is by design; does XBoard allow quotes and spaces as part of the variant name? I guess I assumed that it didn't.
I think it would allow everything except commas and double quotes. I guess the more general problem is whether some form of standardization is desirable for the sytax of engine-defined variant names. Sjaak and Stockfish use, fe, "kingofthehill" without spaces, hyphens or underscores. Sjaak likewise uses "minishogi". I wonder if the mention of "shogi" in the variant name should best be omitted. I did that in the WB Alien Edition, where some of the Shogi variants are standard variants (tenjiku, dai,tai). Shokidoki now announces "mini,judkin,tori", in addition to the NxM+H_ systematic names. OTOH it says "euroshogi", so it is not very consistent. (And Judkins lost an 's'...) I suppose "mini" could become overloaded; there probably also exist many kinds of mini-Chess. "judkins" is probably unique enough. In CrazyWa I now use "minishogi,judkinshogi,crazywa". I suppose all this is not very important, because Sjaak has a "variant alias" option. (How do I use that anyway?)
Tell me about it.
I haven't found a king safety term that works well across variants. I suppose a plain "king should not be ahead of any pawns" might be adequate as a middle-game term (I don't advance game phase in drop variants).
That would certainly be a good idea: Kings should have a very large preferece to stay behind the initial Pawn rank. In CrazyWa I have a King PST that gives 90cP penalty for being inside the Pawn rank, and 210cP for being between the Pawn ranks. In addition the Evaluation gives another 100cP for getting in range of being checked by Pawns on their starting rank. I also add points (virtual attacks) to the non-linear king-seige term, for being in the Pawn rank, before it, or in enemy range. The only variant dependence here is that the number of virtual attacks doubles on boards >= 8x8, but I am pretty sure this could also be made implicit as a condition of the total material value in the game. As there also is a term of the form 'attacked empty squares adjacent to King times total hand value', and venturing out in the open usually means lots of adjacent empty squares, king strolls are really quite heavily discouraged. I top off King (un)safety only at 900cP.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II 1.4.1 and Shogi

Post by Evert »

hgm wrote:
Evert wrote:Are you sure the working directory is the one that holds variants.txt? I remember his being tricky when starting programs in Windows.
Sure. I started it from the command line, in the directory where everything is:
Ah, right. It doesn't actually load variants.txt from the current directory, it loads it from the install location. Which works out to /usr/local/share/games/sjaakii on *nix, and probably something like C:/Program Files/share/games/sjaakii, if at all. I suppose that's not very useful.
It's controlled by the SJAAKII_DATA_DIR configuration option in CMake, which sets the variable DATADIR (it passes -DDATADIR=${SJAAKII_DATA_DIR}). The MSVS build files don't set DATADIR, so it never autoloads variants.txt. I guess a sensible default value is "."?

By the way, if you want a list of the variants it currently knows about, you can type "variants", the output of which I personally find easier to read than the response to protover.
I think it would allow everything except commas and double quotes.
Ok, I guess I originally assumed it only accepted names without spaces or special characters, probably because the default names follow that scheme. Which, come to think of it, is probably more of a historical coincidence.
I guess the more general problem is whether some form of standardization is desirable for the sytax of engine-defined variant names.
Yes, it is.
Sjaak and Stockfish use, fe, "kingofthehill" without spaces, hyphens or underscores.
Sjaak actually defines it with and without hyphens.
Sjaak likewise uses "minishogi". I wonder if the mention of "shogi" in the variant name should best be omitted.
Perhaps. We omit "chess" in things like "crazyhouse" and "spartan". If we're left with something as generic as "mini" it's probably not a good idea though.
I suppose all this is not very important, because Sjaak has a "variant alias" option. (How do I use that anyway?)
Set it to "<sjaak name>=<other name>". It will then announce that it also plays "<other name>" (it re-sends the list of variants it knows) and it will respond to "variant <other name>".
That would certainly be a good idea: Kings should have a very large preferece to stay behind the initial Pawn rank. In CrazyWa I have a King PST that gives 90cP penalty for being inside the Pawn rank, and 210cP for being between the Pawn ranks. In addition the Evaluation gives another 100cP for getting in range of being checked by Pawns on their starting rank. I also add points (virtual attacks) to the non-linear king-seige term, for being in the Pawn rank, before it, or in enemy range. The only variant dependence here is that the number of virtual attacks doubles on boards >= 8x8, but I am pretty sure this could also be made implicit as a condition of the total material value in the game. As there also is a term of the form 'attacked empty squares adjacent to King times total hand value', and venturing out in the open usually means lots of adjacent empty squares, king strolls are really quite heavily discouraged. I top off King (un)safety only at 900cP.
I have a cap at 416, which I think was based on games not involving drops (FIDE chess, even, which should be about right). A case could be made that it should be higher for games that do feature drops.
The truly annoying thing is that the king safety it does have already does a lot of what you describe: it penalises the king for not having pawns in front of it (a pawn shelter), which is progressive if squares around the king are attacked. Hand pieces always attack squares near the enemy king, and the middle-game PST penalises a king that moves forward...
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II 1.4.1 and Shogi

Post by hgm »

Well, the following (normal Shogi) games are instructive:

Code: Select all

&#91;Event "Computer Chess Game"&#93;
&#91;Site "ONTWIKKELLAPTOP"&#93;
&#91;Date "2016.12.20"&#93;
&#91;Round "5"&#93;
&#91;White "CrazyWa 1.0.1"&#93;
&#91;Black "Sjaak II 1.4.1"&#93;
&#91;Result "1-0"&#93;
&#91;TimeControl "40/60"&#93;
&#91;Variant "shogi"&#93;
&#91;Annotator "1. +0.36   1... +0.20"&#93;

1. c4 &#123;+0.36/11&#125; g6 &#123;+0.20/8 1.5&#125; 2. Bc3 &#123;+0.28/10 1.7&#125; e6 &#123;+0.39/7 1.4&#125; 3.
Ke2 &#123;+0.35/9 0.9&#125; Kd8 &#123;+0.46/8 0.9&#125; 4. c5 &#123;+0.56/10 1.6&#125; Ke7 &#123;+0.36/9 2.9&#125;
5. Bxh8+ &#123;+0.62/9 1.1&#125; Sxh8 &#123;+0.60/8 0.9&#125; 6. h4 &#123;+0.74/9 2.2&#125; B@e5
&#123;+0.76/7 1.0&#125; 7. B@c3 &#123;+0.66/10 1.0&#125; b6 &#123;+0.44/8 1.6&#125; 8. Bxe5
&#123;+1.20/11 1.6&#125; exe5 &#123;+0.64/9 2.4&#125; 9. h5 &#123;+1.19/9 1.0&#125; B@e6 &#123;+0.66/7 0.8&#125;
10. h6 &#123;+2.61/9 0.9&#125; hxh6 &#123;+1.12/8 1.0&#125; 11. Rxh6 &#123;+2.72/8 1.3&#125; Bxb3+
&#123;+0.91/8 1.7&#125; 12. Rh5 &#123;+2.71/6 1.0&#125; Kf6 &#123;+1.32/6 0.8&#125; 13. P@h7
&#123;+6.02/6 1.3&#125; Sg7 &#123;+1.09/7 1.4&#125; 14. Gc2 &#123;+5.21/7 1.1&#125; +Bd5 &#123;+1.54/7 1.0&#125;
15. Gc3 &#123;+3.49/7 1.8&#125; P@h6 &#123;+1.51/7 0.9&#125; 16. Ri5 &#123;+2.57/8 1.6&#125; i6
&#123;+1.64/7 0.8&#125; 17. Ri4 &#123;+2.17/8 1.6&#125; +Bxc5 &#123;+1.32/7 1.0&#125; 18. Gd4
&#123;+3.64/8 1.5&#125; +Bd6 &#123;+1.10/8 1.2&#125; 19. Nc3 &#123;+3.88/7 0.9&#125; c6 &#123;+1.06/6 1.4&#125; 20.
Nd5 &#123;+7.38/8 2.0&#125; g5 &#123;+0.71/7 1.2&#125; 21. Rf4 &#123;+11.00/9 2.6&#125; Kg6 &#123;+0.85/7 1.5&#125;
22. B@f5 &#123;+11.01/8 1.0&#125; Kh5 &#123;-1.20/7 0.9&#125; 23. h8+ &#123;+13.74/8 1.1&#125; f6
&#123;-1.22/9 1.4&#125; 24. Bh7+ &#123;+12.89/9 1.7&#125; Rxh8 &#123;-1.35/9 2.0&#125; 25. +Bxh8
&#123;+18.52/8 1.2&#125; Sxh8 &#123;-2.45/8 2.0&#125; 26. Rxf6 &#123;+21.64/7 1.2&#125; P@f2
&#123;-3.29/6 2.0&#125; 27. P@h4 &#123;+1000.04/12 1.2&#125; Kxh4 &#123;-159.92/2&#125; 28. Rxh6
&#123;+1000.03/98 0.4&#125; P@h5 &#123;-159.96/2 0.1&#125; 29. R@i4 &#123;+1000.02/7&#125; Kh3
&#123;-159.98/2&#125; 30. Gg2# &#123;+1000.01/2 0.1&#125;
&#123;Xboard adjudication&#58; Checkmate&#125; 1-0
Look at move 12. That is suicidal! CrazyWa's score jumps to +6 immediately, but Sjaak stays positive until move 21.

Code: Select all

&#91;Event "Computer Chess Game"&#93;
&#91;Site "ONTWIKKELLAPTOP"&#93;
&#91;Date "2016.12.20"&#93;
&#91;Round "8"&#93;
&#91;White "Sjaak II 1.4.1"&#93;
&#91;Black "CrazyWa 1.0.1"&#93;
&#91;Result "0-1"&#93;
&#91;TimeControl "40/60"&#93;
&#91;Variant "shogi"&#93;
&#91;Annotator "1. -0.34   1... -0.11"&#93;

1. c4 &#123;-0.34/9&#125; g6 &#123;-0.11/10 0.9&#125; 2. c5 &#123;-0.25/9 1.0&#125; Bxb2+ &#123;-0.27/11 2.5&#125;
3. Rxb2 &#123;-0.18/7 0.8&#125; g5 &#123;-0.23/9 1.2&#125; 4. B@f5 &#123;+0.20/7 1.2&#125; B@i6
&#123;-0.30/9 2.0&#125; 5. Kf2 &#123;+0.30/8 1.8&#125; Ke8 &#123;-0.42/8 0.9&#125; 6. Rc2 &#123;+0.44/7 1.4&#125;
a6 &#123;-0.20/8 2.1&#125; 7. Gde2 &#123;+0.58/8 1.6&#125; a5 &#123;-0.06/9 0.9&#125; 8. d4 &#123;+0.63/8 1.6&#125;
b6 &#123;-0.05/8 1.2&#125; 9. h4 &#123;+0.65/7 1.1&#125; b5 &#123;+0.27/10 2.5&#125; 10. Rc4
&#123;+0.54/8 1.5&#125; Ng7 &#123;+0.20/8 1.0&#125; 11. Be4 &#123;+0.65/8 0.9&#125; e6 &#123;+0.21/9 2.4&#125; 12.
c6 &#123;+0.94/9 1.3&#125; Sc8 &#123;+0.31/8 1.3&#125; 13. Rc5 &#123;+1.11/8 0.8&#125; g4 &#123;+0.39/10 2.3&#125;
14. cxc7+ &#123;+1.12/7 1.7&#125; Sxc7 &#123;+0.39/9 1.2&#125; 15. Rg5 &#123;+0.86/7 1.2&#125; Sh8
&#123;+0.37/8 1.2&#125; 16. i4 &#123;+1.39/6 1.6&#125; gxg3+ &#123;+0.34/8 1.6&#125; 17. Nxg3
&#123;+1.44/5 0.9&#125; P@g4 &#123;+0.19/9 2.6&#125; 18. i5 &#123;+1.20/8 1.3&#125; gxg3+ &#123;+1.02/8 1.1&#125;
19. Kxg3 &#123;+1.20/7 1.0&#125; N@f6 &#123;+1.01/7 0.9&#125; 20. Bd5 &#123;+0.55/8 1.4&#125; Bg4
&#123;+4.73/8 0.8&#125; 21. Rxg4 &#123;+0.09/8 1.8&#125; Nf5 &#123;+5.87/8 1.2&#125; 22. Kf4
&#123;+0.01/6 1.5&#125; Nxg4 &#123;+6.22/8 1.4&#125; 23. B@c2 &#123;-0.74/7 2.2&#125; Sd6 &#123;+6.87/7 1.7&#125;
24. Bxe6 &#123;+0.11/8 1.6&#125; Se5 &#123;+7.00/6 1.1&#125; 25. Kxe5 &#123;+0.76/6 1.6&#125; Ng3=
&#123;+6.79/6 0.8&#125; 26. Gg2 &#123;+1.64/6 1.2&#125; R@f1 &#123;+3.99/6 1.0&#125; 27. Bg6
&#123;+2.17/6 1.0&#125; Gf8 &#123;+4.36/7 1.0&#125; 28. S@f6 &#123;+1.86/6 1.6&#125; Rxc1+ &#123;+6.53/7 1.3&#125;
29. Sxf7+ &#123;+1.86/6 1.6&#125; Ke9 &#123;+6.01/7 1.1&#125; 30. Gxg3 &#123;+1.31/6 1.1&#125; +Rxg1
&#123;+10.52/6 1.3&#125; 31. Gxg4 &#123;+1.16/6 1.4&#125; P@e7 &#123;+9.61/6 1.9&#125; 32. +Sxf8
&#123;-1.53/6 1.7&#125; Rxf8 &#123;+11.04/7 1.7&#125; 33. N@f7 &#123;-2.12/6 2.1&#125; Kd8 &#123;+10.60/7 2.1&#125;
34. N@f4 &#123;-1.34/5 1.4&#125; exe6 &#123;+19.24/6 3&#125; 35. Nxe6 &#123;-1.57/6 2.4&#125; Kc9
&#123;+19.25/6 3&#125; 36. Nxf8+ &#123;-1.15/6 1.5&#125; +Rxg4 &#123;+19.26/4 0.6&#125; 37. R@c6
&#123;-2.24/5 2.3&#125; B@c7 &#123;+22.32/5 2.9&#125; 38. Rxc7+ &#123;-2.72/5 1.8&#125; Nxc7
&#123;+21.81/4 0.3&#125; 39. B@e7 &#123;-3.84/6 2.5&#125; S@d8 &#123;+22.34/4 0.3&#125; 40. P@c8
&#123;-1.33/2 1.2&#125; Kxc8 &#123;+25.41/4 0.4&#125; 41. G@g5 &#123;-3.46/2 1.3&#125; P@e6
&#123;+1000.04/7 0.9&#125; 42. Kxe6 &#123;-159.94/10 0.3&#125; R@c6 &#123;+1000.03/59 0.9&#125; 43. Bd6+
&#123;-159.96/2&#125; Rxd6 &#123;+1000.02/7 0.1&#125; 44. Ke5 &#123;-159.96/2 0.1&#125; G@e6#
&#123;+1000.01/2 0.1&#125;
&#123;Xboard adjudication&#58; Checkmate&#125; 0-1
Here Sjaak is quite content with itself on move 27 (+2.17), with his King on e5. That shouldn't be possible.

This one is also interesting:

Code: Select all

&#91;Event "Computer Chess Game"&#93;
&#91;Site "ONTWIKKELLAPTOP"&#93;
&#91;Date "2016.12.21"&#93;
&#91;Round "17"&#93;
&#91;White "CrazyWa 1.0.1"&#93;
&#91;Black "Sjaak II 1.4.1"&#93;
&#91;Result "1-0"&#93;
&#91;TimeControl "40/60"&#93;
&#91;Variant "shogi"&#93;
&#91;Annotator "1. +0.36   1... +0.29"&#93;

1. c4 &#123;+0.36/12&#125; g6 &#123;+0.29/8 1.1&#125; 2. Rg2 &#123;+0.23/11 2.9&#125; Rg8 &#123;+0.45/8 1.4&#125;
3. c5 &#123;+0.24/10 0.9&#125; Kd8 &#123;+0.41/8 1.1&#125; 4. b4 &#123;+0.35/10 1.3&#125; Bxb2+
&#123;+0.63/10 1.9&#125; 5. Rxb2 &#123;+0.36/10 1.2&#125; B@d5 &#123;+0.38/7 1.1&#125; 6. Ke2
&#123;+1.47/10 1.7&#125; f6 &#123;+0.30/7 1.1&#125; 7. b5 &#123;+1.91/9 1.2&#125; Rf8 &#123;+0.15/8 1.4&#125; 8.
Nc3 &#123;+2.01/9 1.0&#125; Be6 &#123;+0.07/9 1.2&#125; 9. b6 &#123;+1.82/9 1.3&#125; bxb6 &#123;-0.18/9 1.4&#125;
10. Rxb6 &#123;+2.20/8 1.1&#125; P@b8 &#123;-0.23/8 0.9&#125; 11. P@b7 &#123;+1.78/7 1.6&#125; Gc8
&#123;+0.04/8 0.9&#125; 12. bxb8+ &#123;+1.38/8 1.4&#125; Sxb8 &#123;+0.08/7 1.1&#125; 13. Sh2
&#123;+1.24/7 1.4&#125; Ge8 &#123;+0.07/6 1.1&#125; 14. c6 &#123;+1.33/6 2.5&#125; cxc6 &#123;+0.77/7 1.1&#125; 15.
Rxc6 &#123;+0.83/8 4&#125; P@c4 &#123;+0.89/7 1.2&#125; 16. Nb5 &#123;+0.82/7 1.2&#125; Nc7 &#123;+0.97/7 1.2&#125;
17. P@b4 &#123;+0.71/6 1.0&#125; P@b6 &#123;+1.36/7 1.0&#125; 18. Rxb6 &#123;+1.91/7 1.2&#125; c3+
&#123;+1.69/7 1.4&#125; 19. Nxc7+ &#123;+3.06/7 1.4&#125; Kxc7 &#123;+1.13/6 1.4&#125; 20. B@a5
&#123;+4.64/6 0.8&#125; +Pxd3 &#123;+0.72/6 1.5&#125; 21. Kf2 &#123;+3.34/7 1.5&#125; +Pxe3 &#123;+1.46/5 1.0&#125;
22. Kxe3 &#123;+3.88/7 1.0&#125; N@d5 &#123;-0.51/6 1.9&#125; 23. Ke2 &#123;+9.58/7 1.1&#125; P@c6
&#123;+0.71/7 1.0&#125; 24. Rb5 &#123;+13.27/8 1.8&#125; Kd6 &#123;+0.52/6 1.0&#125; 25. N@c4
&#123;+12.57/7 1.2&#125; Ke5 &#123;+1.39/2&#125; 26. P@e4 &#123;+12.98/7 1.3&#125; Kd4 &#123;+1.29/7 1.9&#125; 27.
Gd2 &#123;+12.08/8 1.9&#125; Nc3+ &#123;+1.13/8 1.6&#125; 28. Ge3 &#123;+13.97/7 1.8&#125; Kxc4
&#123;+2.97/2 0.1&#125; 29. P@c2 &#123;+12.72/8 2.2&#125; N@d4 &#123;+3.01/7 1.4&#125; 30. Gxd4
&#123;+14.44/7 1.1&#125; Kxd4 &#123;+2.78/8 2.0&#125; 31. cxc3 &#123;+14.45/6 1.1&#125; G@e3
&#123;+3.05/7 2.6&#125; 32. Kd1 &#123;+13.87/7 4&#125; Sb7 &#123;+2.64/7 4&#125; 33. Sc2 &#123;+13.93/6 0.9&#125;
Gxf3 &#123;+2.58/7 1.7&#125; 34. P@f7 &#123;+18.72/6 1.3&#125; Rxf7 &#123;+3.23/7 3&#125; 35. N@e2
&#123;+15.87/7 0.8&#125; Ke3 &#123;+2.87/7 1.3&#125; 36. Ke1 &#123;+17.16/7 1.1&#125; c5 &#123;+2.88/7 2.1&#125;
37. Rxc5 &#123;+26.11/7 1.8&#125; P@b3 &#123;-0.21/6 2.1&#125; 38. Rxc8+ &#123;+31.03/6 0.5&#125; Gxe2
&#123;-6.62/7 2.0&#125; 39. Gxe2 &#123;+31.04/5 2.5&#125; Kf4 &#123;-7.22/6 1.4&#125; 40. +Rxe8
&#123;+31.05/4 0.4&#125; b2+ &#123;-6.62/6 2.5&#125; 41. G@f3 &#123;+1000.04/9 1.2&#125; Kg5
&#123;-6.43/5 0.8&#125; 42. G@h4 &#123;+1000.03/68 0.9&#125; Kh6 &#123;-159.96/2&#125; 43. G@i5
&#123;+1000.02/98 0.2&#125; Kg7 &#123;-159.98/2&#125; 44. N@h5# &#123;+1000.01/2 0.1&#125;
&#123;Xboard adjudication&#58; Checkmate&#125; 1-0
The seeds of doom are planted with 19... Kxc7. Sure enough, when you recapture with the Silver the white Rook promotes, which is nasty, but heaven compared to a King stroll. CrazyWa immediately starts smoking out the black King, but Sjaak stays perfectly happy until move 36 (+2.88, with his king in the enemy Pawn rank!), where CrazyWa is already at +26 for itself.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II 1.4.1 and Shogi

Post by Evert »

This is proving to be a tricky problem. What gives some good results is including a cubic penalty in the king PST once you reach the third rank (the actual term is "8*r*(r-1)*(r-2)"; there is also a similar cubic term though), but the drawback is that it makes the program focus on drawing out the enemy king (and not advancing its own) in lieu of actually defending its own king. That's a matter of tuning both terms, of course.

Small number of games though; my powerline adapters refuse to speak to each other (might be the christmaslights interfering with the signal) so I can't connect to the desktop PC I use for testing from my laptop. I guess I could use a USB stick to transfer the relevant files, if I can find one.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II 1.4.1 and Shogi

Post by hgm »

Evert wrote:..., but the drawback is that it makes the program focus on drawing out the enemy king (and not advancing its own) in lieu of actually defending its own king.
But I think that is a winning strategy, in drop games. The non-linear King-safety term in CrazyWa is completely one-sided. (There is a small Pawn-shield term that is additive.) That is, it is a bonus for the side to move, based on the seige of the enemy King. All my attempts to involve its own King safety lost Elo.

So what I do is first evaluate without this King safety (PST + Pawn shield, plus some asymmetrically applied 'exposure', defined as the number of non-adjacent squares visible a long slider lines), to see if I can get a 'lazy' stand-pat cutoff. If not, I generate moves, which as a side effect marks all attacked squares. I then count the number of attacked squares next to the King occupied by opponents (N), and the number of such empty squares (M), add

(N + P + 3*M)*(10 + N + P + M + H)*1.5

to the evaluation, and retry the stand-pat. H here is the total hand value of the stm (which in zh amounts to P=1, B,N=3, R=4, Q=7). P is a penalty for not being in your own camp (1 in the original Pawn rank, 3 before it, 11 in enemy Pawn-check range). Then I still add 150 if there is only one safe square next to the King, and 300 if there are none. The term saturates at 900cP (Q=600).
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II 1.4.1 and Shogi

Post by Evert »

hgm wrote:A completely different issue: Sjaak II lost a mini-Shogi game by repetition:
Ok, I see what happens here. I hadn't considered that allowing Black to repeat the position loses the game for White. The problem here is that SjaakII sees the repetition, but it considers all repetitions to be illegal and so doesn't consider it.

I guess I'm fixing this afterall...
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II 1.4.1 and Shogi

Post by hgm »

I see, it was surprised by a move that was illegal. I suppose you could simply have more options for the repeat result: draw, white wins, black wins, repeater loses, repeater wins...
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II 1.4.1 and Shogi

Post by Evert »

hgm wrote:
Evert wrote:..., but the drawback is that it makes the program focus on drawing out the enemy king (and not advancing its own) in lieu of actually defending its own king.
But I think that is a winning strategy, in drop games.
Not if you don't have the momentum to pull it off and allow your opponent to drop-mate you.
So what I do is first evaluate without this King safety (PST + Pawn shield, plus some asymmetrically applied 'exposure', defined as the number of non-adjacent squares visible a long slider lines), to see if I can get a 'lazy' stand-pat cutoff. If not, I generate moves, which as a side effect marks all attacked squares. I then count the number of attacked squares next to the King occupied by opponents (N), and the number of such empty squares (M), add

(N + P + 3*M)*(10 + N + P + M + H)*1.5

to the evaluation, and retry the stand-pat. H here is the total hand value of the stm (which in zh amounts to P=1, B,N=3, R=4, Q=7). P is a penalty for not being in your own camp (1 in the original Pawn rank, 3 before it, 11 in enemy Pawn-check range). Then I still add 150 if there is only one safe square next to the King, and 300 if there are none. The term saturates at 900cP (Q=600).
I think the main difference with the term I have (apart from being symmetric) is that it considers attacks around the king as a factor in the "hand" bonus. I have a tempo-bonus that depends only on hand-material (P=1/2, N=B=4, R=6, Q=12).
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II 1.4.1 and Shogi

Post by Evert »

hgm wrote:I see, it was surprised by a move that was illegal. I suppose you could simply have more options for the repeat result: draw, white wins, black wins, repeater loses, repeater wins...
Yes, but that still requires some refactoring. At the moment I just have a variable that holds the value that is returned for a repeated position (ILLEGAL, LOSS, DRAW, WIN).
Perhaps the simplest way to do this is to make it an array rather than a scalar, and have different result values for black and white. If I do that in general I could also do things like make stalemate a win for Black, but a draw for White...
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II 1.4.1 and Shogi

Post by hgm »

The idea was that check-drops cannot be very dangerous if the King simply gobbles up the dropped material, or if you can interpose something (usually a Pawn from the hand). You need some foothold to use the material effectively. This is why attacked empty squares have a higher weight than attacks on pieces.

I am not convinced by the 'momentum to finish it off' argument. If you don't have the material to finish off a King standing in the center, you won't in general have enough to defend your own King either. Defending is harder than attacking. Incorporating the rank penalty in the non-linear seige term as virtual attacked squares takes care of this for a large part anyway. With an empty hand and no attacks the rank penalty does not hurt so much.