Perft figures for a few variants

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Perft figures for a few variants

Post by ilari »

I need to verify move generation + makemove/undomove for the following variants:
- losers chess: http://www.freechess.org/Help/HelpFiles/losers.html
- atomic chess: http://www.freechess.org/Help/HelpFiles/atomic.html
- crazyhouse: http://www.freechess.org/Help/HelpFiles/crazyhouse.html
- Shogi: http://en.wikipedia.org/wiki/Shogi
- Xianqi: http://en.wikipedia.org/wiki/Xiangqi

Does anyone have some perft figures for these variants, or are there freely available applications (engines?) that can help?
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: Perft figures for a few variants

Post by TonyJH »

I have values for three of those variants. I haven't confirmed all of these with other programs.
http://tonyjh.com/chess/technical/

Xiangqi:

ply=1, positions=44
ply=2, positions=1920
ply=3, positions=79666
ply=4, positions=3290240
ply=5, positions=133312995
ply=6, positions=5392831844

Shogi:

ply=1, positions=30
ply=2, positions=900
ply=3, positions=25470
ply=4, positions=719731
ply=5, positions=19861490
ply=6, positions=547581517

Crazyhouse:

ply=1, positions=20
ply=2, positions=400
ply=3, positions=8902
ply=4, positions=197281
ply=5, positions=4888832
ply=6, positions=120812942
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Perft figures for a few variants

Post by ilari »

Okay, now my Crazyhouse numbers seem to be correct. But I can't figure out what's wrong with my Shogi perft. This is what I get for perft 4 in the starting position:

Code: Select all

FEN: lnsgkgsnl/1b5r1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL w 
l n s g k g s n l 
. b . . . . . r . 
p p p p p p p p p 
. . . . . . . . . 
. . . . . . . . . 
. . . . . . . . . 
P P P P P P P P P 
. B . . . . . R . 
L N S G K G S N L 

i1i2: 23772
g1g2: 19527
g1f2: 20376
f1g2: 19527
f1e2: 21225
f1f2: 21225
e1e2: 22923
e1f2: 22074
e1d2: 23772
d1e2: 21225
d1c2: 22923
d1d2: 22923
c1c2: 23772
c1d2: 22923
a1a2: 25470
h2i2: 25472
h2c2: 24623
h2d2: 23774
h2e2: 23774
h2f2: 23774
h2g2: 24623
i3i4: 27168
h3h4: 26319
g3g4: 26387
f3f4: 25412
e3e4: 25467
d3d4: 25470
c3c4: 30286
b3b4: 25470
a3a4: 28015

Perft: 719691
But you have a value of 719731. Drops can be ignored at this depth, so this should be an easy one to fix. Is there a "perft" or "divide" command for TJshogi so that I could try to find out where the problem is?
User avatar
hgm
Posts: 27794
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Perft figures for a few variants

Post by hgm »

Your perft counts are OK, but that is not the inital position of Shogi! :lol:
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Perft figures for a few variants

Post by ilari »

hgm wrote:Your perft counts are OK, but that is not the inital position of Shogi! :lol:
I know that the colors should be reversed, but that shouldn't affect the perft counts. Is there something else wrong with the position, or are Tony's numbers incorrect?
User avatar
Kirill Kryukov
Posts: 492
Joined: Sun Mar 19, 2006 4:12 am

Re: Perft figures for a few variants

Post by Kirill Kryukov »

ilari wrote:
hgm wrote:Your perft counts are OK, but that is not the inital position of Shogi! :lol:
I know that the colors should be reversed, but that shouldn't affect the perft counts. Is there something else wrong with the position, or are Tony's numbers incorrect?
Black B and R should be swapped.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Perft figures for a few variants

Post by ilari »

Kirill Kryukov wrote:
ilari wrote:
hgm wrote:Your perft counts are OK, but that is not the inital position of Shogi! :lol:
I know that the colors should be reversed, but that shouldn't affect the perft counts. Is there something else wrong with the position, or are Tony's numbers incorrect?
Black B and R should be swapped.
Thanks, now all seems well. I misinterpreted "The bishop in the same file as the left knight and the rook in the same file as the right knight".
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Perft figures for a few variants

Post by ilari »

I just calculated perft 7 for Shogi. Can anyone verify this?

Code: Select all

FEN: lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL w 

l n s g k g s n l 
. r . . . . . b . 
p p p p p p p p p 
. . . . . . . . . 
. . . . . . . . . 
. . . . . . . . . 
P P P P P P P P P 
. B . . . . . R . 
L N S G K G S N L 

i1i2: 441683687
g1g2: 300723199
g1f2: 341308698
f1g2: 299692898
f1e2: 370180725
f1f2: 376415409
e1e2: 456918050
e1f2: 405647471
e1d2: 479816613
d1e2: 362201645
d1c2: 427288168
d1d2: 442111933
c1c2: 477194778
c1d2: 439033899
a1a2: 550625810
h2i2: 538466257
h2c2: 488208990
h2d2: 467407795
h2e2: 481615976
h2f2: 485819793
h2g2: 521483691
i3i4: 666233156
h3h4: 595322898
g3g4: 622076911
f3f4: 563935223
e3e4: 565456101
d3d4: 551085704
c3c4: 1075043596
b3b4: 551306103
a3a4: 741964430

Perft: 15086269607
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: Perft figures for a few variants

Post by TonyJH »

I just tried perft 7 and got the same number, 15086269607 (using a version of TJshogi that supports perft).

Could you try this position?

Code: Select all

WB FEN:  7lk/9/8S/9/9/9/9/7L1/8K[P] w 0 1
(white holds a pawn)
(SFEN: 7lk/9/8S/9/9/9/9/7L1/8K b P 1)

 .  .  .  .  .  .  .  l  k
 .  .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .  S
 .  .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  .  .
 .  .  .  .  .  .  .  L  .
 .  .  .  .  .  .  .  .  K
ply=1, positions=85
ply=2, positions=639
ply=3, positions=10786
ply=4, positions=167089
ply=5, positions=3459265

If white was allowed to drop a pawn with mate, this would be a mate-in-1, but since that's not allowed, it's a mate-in-2.
If perft accounts for this rule, first ply has 85 legal moves (unless I made a mistake). Otherwise you will count 86.

It seems that perft 7 from the starting position never encounters this rule, because I get the same results whether or not this rule is followed.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Perft figures for a few variants

Post by ilari »

TonyJH wrote:I just tried perft 7 and got the same number, 15086269607 (using a version of TJshogi that supports perft).

Could you try this position?
...
I can confirm those numbers up to ply 4, but my ply 5 number is different:

Code: Select all

FEN: 7lk/9/8S/9/9/9/9/7L1/8K w P

. . . . . . . l k 
. . . . . . . . . 
. . . . . . . . S 
. . . . . . . . . 
. . . . . . . . . 
. . . . . . . . . 
. . . . . . . . . 
. . . . . . . L . 
. . . . . . . . K 

p@h1: 24855
p@g1: 16620
p@f1: 16781
p@e1: 16781
p@d1: 16781
p@c1: 16781
p@b1: 16781
p@a1: 16781
p@i2: 15206
p@g2: 16443
p@f2: 16584
p@e2: 16584
p@d2: 16584
p@c2: 16584
p@b2: 16584
p@a2: 16584
p@i3: 16525
p@h3: 18444
p@g3: 16483
p@f3: 16584
p@e3: 16584
p@d3: 16584
p@c3: 16584
p@b3: 16584
p@a3: 16584
p@i4: 16730
p@h4: 11361
p@g4: 16620
p@f4: 16584
p@e4: 16584
p@d4: 16584
p@c4: 16584
p@b4: 16584
p@a4: 16584
p@i5: 16486
p@h5: 12172
p@g5: 16618
p@f5: 16685
p@e5: 16685
p@d5: 16685
p@c5: 16685
p@b5: 16685
p@a5: 16685
p@i6: 15488
p@h6: 21915
p@g6: 18665
p@f6: 18738
p@e6: 18738
p@d6: 18738
p@c6: 18738
p@b6: 18738
p@a6: 18536
p@h7: 18755
p@g7: 18210
p@f7: 18637
p@e7: 18637
p@d7: 18637
p@c7: 18637
p@b7: 18637
p@a7: 18435
p@h8: 15097
p@g8: 16684
p@f8: 16786
p@e8: 16786
p@d8: 16786
p@c8: 16786
p@b8: 16786
p@a8: 16685
i1h1: 91255
i1i2: 144368
h2h8+l: 56775
h2h7+l: 59404
h2h9+l: 763212
h2h8: 56775
h2h7: 58192
h2h6: 69773
h2h5: 66984
h2h4: 72829
h2h3: 137829
i7i8+s: 124322
i7h6+s: 110968
i7h8+s: 117869
i7i8: 124322
i7h6: 116590
i7h8: 124198

Perft: 3458811