Page 3 of 3

Re: Shogi Perft numbers

Posted: Sat Aug 24, 2019 11:25 am
by hgm
Patrice Duhamel wrote: Sat Aug 24, 2019 11:23 am What GUI are using USI protocol ?
Shogidogoro, BCM Games and gShogi. And perhaps Tagua.

Re: Shogi Perft numbers

Posted: Sat Aug 24, 2019 12:33 pm
by Ferdy
Patrice Duhamel wrote: Sat Aug 24, 2019 11:23 am What GUI are using USI protocol ?
There is also ShogiGui, and of course Winboard.

Re: Shogi Perft numbers

Posted: Wed Sep 04, 2019 1:08 am
by IanO
I've never concerned myself with perft in my game programs before, but is it supposed to detect checkmates in order to avoid playing past fools mates? I was wondering if

Code: Select all

perft 7
could be used to enumerate all the shortest mates in shogi.

Re: Shogi Perft numbers

Posted: Wed Sep 04, 2019 8:55 am
by hgm
Sure. Perft only considers legal moves, so it cannot calculate past stalemate or checkmate. It does calculate past 3-fold reps, though.

Re: Shogi Perft numbers

Posted: Wed Sep 04, 2019 6:34 pm
by Patrice Duhamel
IanO wrote: Wed Sep 04, 2019 1:08 am I've never concerned myself with perft in my game programs before, but is it supposed to detect checkmates in order to avoid playing past fools mates? I was wondering if

Code: Select all

perft 7
could be used to enumerate all the shortest mates in shogi.
There are 29 mate positions at depth 7 :

Code: Select all

nodes = 15 086 269 607 
Captures = 156 289 904 
Promotions = 78 496 954 
Drops = 22 189 844 
Checks = 79 636 812 
Mates = 29

Re: Shogi Perft numbers

Posted: Mon Sep 09, 2019 11:32 pm
by IanO
Patrice Duhamel wrote: Wed Sep 04, 2019 6:34 pm
IanO wrote: Wed Sep 04, 2019 1:08 am I've never concerned myself with perft in my game programs before, but is it supposed to detect checkmates in order to avoid playing past fools mates? I was wondering if

Code: Select all

perft 7
could be used to enumerate all the shortest mates in shogi.
There are 29 mate positions at depth 7 :

Code: Select all

nodes = 15 086 269 607 
Captures = 156 289 904 
Promotions = 78 496 954 
Drops = 22 189 844 
Checks = 79 636 812 
Mates = 29
Thanks! Those stats were perfect for verifying the shogi perft I wrote this weekend. Turns out there are 11 unique 7-move mate positions in shogi, expressing 6 themes:

[d]lnfw1wfnl/5rkb1/pppppppWp/9/9/9/PPPPPPP1P/1B5R1/LNFWKWFNL b

[d]lnfw1kQnl/1r2wB3/pppppp1pp/6p2/9/2P6/PP1PPPPPP/7R1/LNFWKWFNL b

[d]lnfw1w1nl/1r2kB1b1/ppppFp1pp/4p4/9/2P6/PP1PPPPPP/7R1/LNFWKWFNL b

[d]lnfww1Qnl/1r2k2b1/ppppFpppp/4p4/9/P8/1PPPPPPPP/7R1/LNFWKWFNL b

[d]lnfwB2nl/1r2kWfb1/pppppp1pp/9/9/2P6/PP1PPPPPP/7R1/LNFWKWFNL b

[d]lnf3fnl/1rwkWQ1b1/pppppp1pp/9/9/2P6/PP1PPPPPP/7R1/LNFWKWFNL b

The 29 transpositions and 5 other mate positions are left as an exercise for the reader. :)

(The fairy FEN support here doesn't support the "+P" style of indicating promoted pieces as in SFEN. I've used 'W' for promoted pawn (same as for gold general) and 'Q' for promoted bishop.)

Re: Shogi Perft numbers

Posted: Tue Sep 10, 2019 12:57 pm
by hgm
[d]lnf3fnl/1rwkWI1b1/pppppp1pp/9/9/2P6/PP1PPPPPP/7R1/LNFWKWFNL b
Yeah, sorry about that. The diagram script still needs some work for the support of fairy pieces, which I so far postponed. For one, I would like to support all XBoard pieces, of which there are now 66, and obvioulsy 1-letter encoding will fail. The symbols XBoard's default theme uses for Shogi Horse and Dragon are currently available as I and J, but I don't think the Gold-like symbols for promoted P, N, L, S can currently be selected.

Of course +P, +N, +L and +S would be obvious choices for their two-character IDs, and +B, +R would be preferable over I, J. To further expand the set I was thinking of punctuation suffixes on the letters, like L', L`, L" or L!

Re: Shogi Perft numbers

Posted: Tue Sep 10, 2019 6:42 pm
by Patrice Duhamel
hgm wrote: Tue Sep 10, 2019 12:57 pm [d]lnf3fnl/1rwkWI1b1/pppppp1pp/9/9/2P6/PP1PPPPPP/7R1/LNFWKWFNL b
Why "Black" and "White" are inverted in Winboard ?
In others GUI Black is the first player.

Code: Select all

Winboard :
lns3snl/1rgkG+B1b1/pppppp1pp/9/9/2P6/PP1PPPPPP/7R1/LNSGKGSNL[P] b 0 4

ShogiGUI or BCMGames :
lns3snl/1rgkG+B1b1/pppppp1pp/9/9/2P6/PP1PPPPPP/7R1/LNSGKGSNL w P 8

Re: Shogi Perft numbers

Posted: Tue Sep 10, 2019 7:46 pm
by hgm
In other Chess variants white is first player.

WinBoard uses ordinary FEN as part of CECP. ShogiGUI and BCMgames uses the incompatible SFEN as part of USI.