Sjaak II 1.4.1 and Shogi

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
hgm
Posts: 22274
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Sjaak II 1.4.1 and Shogi

Post by hgm » Wed Dec 14, 2016 8:59 pm

Sjaak II 1.4.1 crashes as soon as variant shogi is selected (relevant part of debugfile below). Other Shogi variats seem to work; I played a lot of Tori-Shogi games with it against CrazyWa. Although after 40 games it crashed. Shortly before that there seemed to be an enormous delays between the end of one game and the start of the next, and I suspect this meant Sjaak was slow to respond to 'ping'.

Code: Select all

7229 >first : force
7229 >first : ping 2
shuffleOpenings = 0
7397 >first : memory 260
7397 >first : new
random
7398 >first : variant shogi
7398 >first : level 40 1 0
7398 >first : post
7398 >first : hard
7398 >first : easy
7398 >first : ping 3
Impossible move , type = 0
7401 <first &#58; pong 2
7407 <first &#58; # New game 'Chess'
Fatal Error&#58; Error&#58; first chess program &#40;SjaakII_win64_MS.exe&#41; exited unexpectedly
GameEnds&#40;27, Error&#58; first chess program &#40;SjaakII_win64_MS.exe&#41; exited unexpectedly, 2&#41;
11565 >first &#58; result 0-1 &#123;Error&#58; first chess program &#40;SjaakII_win64_MS.exe&#41; exited unexpectedly&#125;
11565 >first &#58; force
11565 >first &#58; ping 4
11565 >first &#58; quit
name = '%APPDATA%\winboard48.ini', expanded name = 'C&#58;\Users\hgm\AppData\Roaming\winboard48.ini'

User avatar
Evert
Posts: 2898
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Sjaak II 1.4.1 and Shogi

Post by Evert » Thu Dec 15, 2016 8:11 am

I'm stumped.
It completes the "new" command, but not the "variant" command, so indeed it crashes there. The thing is, I can't reproduce it here, not even by running the Windows binary using Wine.

There is one caveat: I couldn't test the 64 bit version, just the 32 bit version. Is it possible that it was compiled using options not supported by your CPU? Seems unlikely, but if it was then the problem should also show up in something like Capablanca. The 32 bit version should also work.

Not sure what happens to make it crash in Tori, I'll try to look into that too. Might have to wait for the holidays though. Does -xreuse work around the problem?

mar
Posts: 1832
Joined: Fri Nov 26, 2010 1:00 pm

Re: Sjaak II 1.4.1 and Shogi

Post by mar » Thu Dec 15, 2016 1:20 pm

I can reproduce the problem, it's stack overflow in gametemplate::init. I can try to recompile with larger stack size.
EDIT:
it seems sizeof(movegen_t<kind) is over 4 megabytes, windows default stack size is 1 MB

replacing

Code: Select all

      movegen = movegen_t<kind>();
with

Code: Select all

      static movegen_t<kind> init_movegen;
      movegen = init_movegen;
in game.h/init() fixes the problem

it's possible that other compilers avoid creating the temporary and fill directly, what puzzles me though is why the 32-bit version works

User avatar
Evert
Posts: 2898
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Sjaak II 1.4.1 and Shogi

Post by Evert » Thu Dec 15, 2016 2:19 pm

mar wrote:I can reproduce the problem, it's stack overflow in gametemplate::init. I can try to recompile with larger stack size.
EDIT:
it seems sizeof(movegen_t<kind) is over 4 megabytes, windows default stack size is 1 MB

replacing

Code: Select all

      movegen = movegen_t<kind>();
with

Code: Select all

      static movegen_t<kind> init_movegen;
      movegen = init_movegen;
in game.h/init() fixes the problem

it's possible that other compilers avoid creating the temporary and fill directly, what puzzles me though is why the 32-bit version works
Bear in mind that I run it under Wine, which probably means it inherits the stack space from the host system (apparently 8MB on OSX).
Either way, allocating 4MB on the stack seems excessive, I'll look at that.

User avatar
Evert
Posts: 2898
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Sjaak II 1.4.1 and Shogi

Post by Evert » Fri Dec 16, 2016 7:46 am

mar wrote:I can reproduce the problem, it's stack overflow in gametemplate::init. I can try to recompile with larger stack size.
EDIT:
it seems sizeof(movegen_t<kind) is over 4 megabytes, windows default stack size is 1 MB

replacing

Code: Select all

      movegen = movegen_t<kind>();
with

Code: Select all

      static movegen_t<kind> init_movegen;
      movegen = init_movegen;
in game.h/init() fixes the problem

it's possible that other compilers avoid creating the temporary and fill directly, what puzzles me though is why the 32-bit version works
I have updated the Windows archive with your new compiles, thanks!

User avatar
Evert
Posts: 2898
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Sjaak II 1.4.1 and Shogi

Post by Evert » Fri Dec 16, 2016 7:56 am

It seems that movegen_t doesn't actually have an explicit constructor, it relies on a member function to do explicit initialisation. That means that it should be harmless to remove the initialisation entirely.

This certainly seems to be ok when I do that here, but I can't test it directly under Windows.

mar
Posts: 1832
Joined: Fri Nov 26, 2010 1:00 pm

Re: Sjaak II 1.4.1 and Shogi

Post by mar » Sat Dec 17, 2016 9:18 pm

Evert wrote:This certainly seems to be ok when I do that here, but I can't test it directly under Windows.
Tested it without movegen_t assignment. test benchmark works fine, no crashes when initializing with variant shogi.

Didn't test real games though.

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

Re: Sjaak II 1.4.1 and Shogi

Post by hgm » Tue Dec 20, 2016 9:59 am

A completely different issue: Sjaak II lost a mini-Shogi game by repetition:

Code: Select all

&#91;Event "Computer Chess Game"&#93;
&#91;Site "ONTWIKKELLAPTOP"&#93;
&#91;Date "2016.12.20"&#93;
&#91;Round "10"&#93;
&#91;White "Sjaak II 1.4.1"&#93;
&#91;Black "CrazyWa 1.0.0"&#93;
&#91;Result "0-1"&#93;
&#91;TimeControl "40/60"&#93;
&#91;Variant "minishogi"&#93;
&#91;FEN "rbsgk/4p/5/P4/KGSBR&#91;-&#93; w 0 1"&#93;
&#91;SetUp "1"&#93;

&#123;--------------
r b s g k
. . . . p
. . . . .
P . . . .
K G S B R
white to play
--------------&#125;
1. Bc2 &#123;-0.10/13&#125; Gd4 &#123;-0.02/12 1.2&#125; 2. Sd2 &#123;-0.09/13 0.9&#125; Kd5
&#123;-0.23/11 1.4&#125; 3. Rd1 &#123;+0.06/11 1.1&#125; Be2 &#123;+0.61/12 1.3&#125; 4. Re1
&#123;+0.03/12 1.1&#125; Bb5 &#123;+1000.01/98 0.2&#125; 5. Gb2 &#123;+0.06/13 2.0&#125; Sb4
&#123;+0.05/11 1.4&#125; 6. Rd1 &#123;+0.04/12 0.9&#125; Be2 &#123;+0.08/11 0.9&#125; 7. Re1
&#123;+0.04/13 1.7&#125; Bb5 &#123;+1000.01/98 0.2&#125; 8. Rc1 &#123;-0.07/13 1.1&#125; Bc4
&#123;+0.17/11 1.9&#125; 9. Rd1 &#123;+0.50/12 0.9&#125; Be2 &#123;+1000.01/98 0.2&#125; 10. Rc1
&#123;-0.06/12 0.9&#125; Bc4 &#123;+1000.01/98 0.2&#125; 11. Re1 &#123;-0.07/12 0.9&#125; Bb5
&#123;+1000.01/98 0.2&#125; 12. Kb1 &#123;-0.04/14 1.7&#125; Bc4 &#123;+0.04/11 1.1&#125; 13. Rd1
&#123;+0.04/12 1.0&#125; Be2 &#123;-0.07/10 1.0&#125; 14. Re1 &#123;+0.36/13 1.6&#125; Bc4
&#123;+1000.01/98 0.2&#125; 15. Bd1 &#123;-0.98/11 1.8&#125; Ke5 &#123;+1.20/11 2.1&#125; 16. Bc2
&#123;-0.12/12 0.9&#125; Kd5 &#123;+1000.01/98 0.2&#125; 17. Kc1 &#123;-1.03/12 1.8&#125; Rb5
&#123;-0.20/11 2.3&#125; 18. Kb1 &#123;-0.07/11 1.0&#125; Ra5 &#123;+1000.01/98 0.2&#125;
&#123;Xboard adjudication&#58; repetition&#125; 0-1

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

Re: Sjaak II 1.4.1 and Shogi

Post by hgm » Wed Dec 21, 2016 5:34 pm

Some other Sjaak issues:

* The Windows version of Sjaak does not seem able to find its variants.txt file. Apparently it does not look for it in the current directory. Not even when I give the filename on the command line (or that of a user-supplied file). I have to give the full path name as an argument to make the user-defined variants available.

* In the variants.txt file supplied with Sjaak II, there is a definition of Judkins' Shogi, but the method for forging this into a name for in the CECP variants feature does not seem to understand the quote, so that it appears as 'judkins'.

* Sjaak seems to have a King-safety issue in the larger Shogi variants. In Crazyhouse, mini-Shogi and Tori Shogi Sjaak scores 35-40% against CrazyWa (40 moves/min), in Judkins' Shogi even ~50%. (I don't understand why CrazyWa has so much difficulty with this. It seems to make wrong trades with the Knights all the time.) But is regular Shogi I stopped at a pathetic 17.5-0.5 (the draw being due to an 6-move game where both sides just moved their Golds back and forth). In Wa it is now 16-3 for CrazyWa. Sjaak happily moves his King in front of his Pawns (which Crazywa is eager enough to stimulate, when it gets the chance, but sometimes even happens spontaneously). This is totally lethal, even in games where it is very much ahead in material.

User avatar
Evert
Posts: 2898
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Sjaak II 1.4.1 and Shogi

Post by Evert » Wed Dec 21, 2016 7:21 pm

hgm wrote: * The Windows version of Sjaak does not seem able to find its variants.txt file. Apparently it does not look for it in the current directory. Not even when I give the filename on the command line (or that of a user-supplied file). I have to give the full path name as an argument to make the user-defined variants available.
Are you sure the working directory is the one that holds variants.txt? I remember his being tricky when starting programs in Windows.
Note that you can also specify the file in the engine options dialog. Since SjaakII has persistent options, it will remember this for the next time.
* In the variants.txt file supplied with Sjaak II, there is a definition of Judkins' Shogi, but the method for forging this into a name for in the CECP variants feature does not seem to understand the quote, so that it appears as 'judkins'.
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.
* Sjaak seems to have a King-safety issue in the larger Shogi variants. In Crazyhouse, mini-Shogi and Tori Shogi Sjaak scores 35-40% against CrazyWa (40 moves/min), in Judkins' Shogi even ~50%. (I don't understand why CrazyWa has so much difficulty with this. It seems to make wrong trades with the Knights all the time.) But is regular Shogi I stopped at a pathetic 17.5-0.5 (the draw being due to an 6-move game where both sides just moved their Golds back and forth). In Wa it is now 16-3 for CrazyWa. Sjaak happily moves his King in front of his Pawns (which Crazywa is eager enough to stimulate, when it gets the chance, but sometimes even happens spontaneously). This is totally lethal, even in games where it is very much ahead in material.
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).

I'll check the repetition issue. It should avoid all repetitions (because I don't have side-specific rules).

Post Reply