Shogi Perft numbers

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, Dann Corbit, hgm

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

Re: Shogi Perft numbers

Post by hgm » Sat Aug 24, 2019 9:25 am

Patrice Duhamel wrote:
Sat Aug 24, 2019 9:23 am
What GUI are using USI protocol ?
Shogidogoro, BCM Games and gShogi. And perhaps Tagua.
Get rid of the shit: vote for SHID!

Ferdy
Posts: 4309
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Shogi Perft numbers

Post by Ferdy » Sat Aug 24, 2019 10:33 am

Patrice Duhamel wrote:
Sat Aug 24, 2019 9:23 am
What GUI are using USI protocol ?
There is also ShogiGui, and of course Winboard.

IanO
Posts: 484
Joined: Wed Mar 08, 2006 8:45 pm
Location: Portland, OR
Contact:

Re: Shogi Perft numbers

Post by IanO » Tue Sep 03, 2019 11:08 pm

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.

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

Re: Shogi Perft numbers

Post by hgm » Wed Sep 04, 2019 6:55 am

Sure. Perft only considers legal moves, so it cannot calculate past stalemate or checkmate. It does calculate past 3-fold reps, though.
Get rid of the shit: vote for SHID!

Patrice Duhamel
Posts: 147
Joined: Sat May 25, 2013 9:17 am
Location: France
Full name: Patrice Duhamel
Contact:

Re: Shogi Perft numbers

Post by Patrice Duhamel » Wed Sep 04, 2019 4:34 pm

IanO wrote:
Tue Sep 03, 2019 11:08 pm
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
Anything that can go wrong will go wrong.

IanO
Posts: 484
Joined: Wed Mar 08, 2006 8:45 pm
Location: Portland, OR
Contact:

Re: Shogi Perft numbers

Post by IanO » Mon Sep 09, 2019 9:32 pm

Patrice Duhamel wrote:
Wed Sep 04, 2019 4:34 pm
IanO wrote:
Tue Sep 03, 2019 11:08 pm
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:













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.)

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

Re: Shogi Perft numbers

Post by hgm » Tue Sep 10, 2019 10:57 am


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!
Get rid of the shit: vote for SHID!

Patrice Duhamel
Posts: 147
Joined: Sat May 25, 2013 9:17 am
Location: France
Full name: Patrice Duhamel
Contact:

Re: Shogi Perft numbers

Post by Patrice Duhamel » Tue Sep 10, 2019 4:42 pm

hgm wrote:
Tue Sep 10, 2019 10:57 am
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
Anything that can go wrong will go wrong.

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

Re: Shogi Perft numbers

Post by hgm » Tue Sep 10, 2019 5:46 pm

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.
Get rid of the shit: vote for SHID!

Post Reply