Shatranj perfts

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

ibid
Posts: 89
Joined: Mon Jun 13, 2011 12:09 pm

Shatranj perfts

Post by ibid »

What to do when you're too lazy to turn your core routines into an actual engine?
Compute more perfts of course...

Following is a table of unique positions and perfts for Shatranj. These match the numbers
I got years ago with my old shatranj engine, which is reassuring. It would be more convincing
to have independent verification of some perfts though... does anyone know of a publically
available perft-capable Shatranj engine I can use for comparison's sake? Doesn't have to use
hash tables or anything: brute-forcing the first few ply would suffice. Thanks!

Code: Select all

ply        unique                    perft
 1             16                       16
 2            256                      256
 3          2,304                    4,176
 4         20,736                   68,122
 5        145,266                1,164,248
 6      1,021,749               19,864,709
 7      6,271,768              357,218,656
 8     38,721,595            6,408,026,890
 9    218,347,985          120,750,846,281
10  1,241,703,484        2,269,622,343,812
11  6,624,556,236       44,585,818,929,451
12                     873,869,476,176,146
13                  17,808,138,061,220,658
14                 362,223,142,398,591,074
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Shatranj perfts

Post by Daniel Shawul »

Paul,
my engine nebiyu and HG's engines support many chess variants. As to your perft result the results match. Nebiyu has a very slow perft though.

Code: Select all

perft 4 
h2h3  3915 
g2g3  4176 
f2f3  4176 
e2e3  4437 
d2d3  4698 
c2c3  4176 
b2b3  4176 
a2a3  3915 
g1h3  4177 
g1f3  4960 
b1c3  4958 
b1a3  4176 
f1h3  3654 
f1d3  4176 
c1e3  4437 
c1a3  3915 
nodes 68122 
time 0.05 sec 
perft 6 
h2h3  1066655 
g2g3  1163857 
f2f3  1178010 
e2e3  1318410 
d2d3  1470254 
c2c3  1171567 
b2b3  1163900 
a2a3  1062225 
g1h3  1211844 
g1f3  1637880 
b1c3  1657184 
b1a3  1217310 
f1h3  950138 
f1d3  1200263 
c1e3  1333680 
c1a3  1061532 
nodes 19864709 
time 3.63 sec 
perft 7 
h2h3  18192042 
g2g3  19861290 
f2f3  20357178 
e2e3  23792340 
d2d3  27719784 
c2c3  20055547 
b2b3  19875891 
a2a3  18049765 
g1h3  21991511 
g1f3  32826884 
b1c3  33295588 
b1a3  22061643 
f1h3  15681884 
f1d3  21115879 
c1e3  24355965 
c1a3  17985465 
nodes 357218656 
time 65.84 sec 
perft 8
h2h3  327186103
g2g3  357063653
f2f3  366431904
e2e3  427437304
d2d3  498499709
c2c3  360303857
b2b3  357347311
a2a3  324455852
g1h3  391106490
g1f3  580576470
b1c3  597149435
b1a3  396004932
f1h3  282288309
f1d3  380241010
c1e3  438393416
c1a3  323541135
nodes 6408026890
time 1153.56 sec
You can download nebiyu from first link in my signature.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Shatranj perfts

Post by Daniel Shawul »

And last but not least a quick perft(14) estimation using montecarlo method

Code: Select all

3.621702e+017 +- 8.849199e+013 131593922
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Shatranj perfts

Post by Evert »

ibid wrote:It would be more convincing
to have independent verification of some perfts though... does anyone know of a publically
available perft-capable Shatranj engine I can use for comparison's sake? Doesn't have to use
hash tables or anything: brute-forcing the first few ply would suffice. Thanks!
Sjaak has a perft utility, although there is no binary for it in the default download (http://www.eglebbk.dds.nl/program/chess-download.html). I also have some perft results for different variants (http://www.eglebbk.dds.nl/program/chess-perft.html) but not for Shatranj for some reason.
ibid
Posts: 89
Joined: Mon Jun 13, 2011 12:09 pm

Re: Shatranj perfts

Post by ibid »

Thank you both, that is exactly what I was looking for!

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

Re: Shatranj perfts

Post by hgm »

ibid wrote:These match the numbers
I got years ago with my old shatranj engine, which is reassuring.
You do have a Shatranj engine? :shock:
ibid
Posts: 89
Joined: Mon Jun 13, 2011 12:09 pm

Re: Shatranj perfts

Post by ibid »

hgm wrote:
ibid wrote:These match the numbers
I got years ago with my old shatranj engine, which is reassuring.
You do have a Shatranj engine? :shock:
I do indeed. :)

I used to run a computer on ICC years ago that could play everything ICC offered, Shatranj included (it could even play a very bad game of Kriegspiel... and Checkers during that very brief time ICC offered it). It appears the account still exists, G2K(C), and ICC saved a few of its games in their database (presumably because the opponents had titles). Here is a bad game from the very first day the Shatranj engine ran back in 2001 (I remember this well, because it was simply using a regular chess evaluation with some rather arbitrarily chosen piece values... and it was quite embarrassing watching it play so badly against a GM... attempting to manually castle and trapping its own rook...).

[Event "ICC w28 10 6"]
[Site "Internet Chess Club"]
[Date "2001.09.02"]
[Round "-"]
[White "G2K"]
[Black "Petrovich"]
[Result "1-0"]
[WhiteElo "1601"]
[BlackElo "1855"]
[Time "08:55:03"]
[TimeControl "600+6"]
[Variant "Shatranj"]
[SetUp "1"]
[FEN "rnbkqbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBKQBNR w - - 0 1"]

1. Nf3 e6 2. Nc3 d6 3. d3 d5 4. e3 c6 5. e4 Nf6 6. Be3 Nbd7 7. e5 Ng4 8. d4
f6 9. h3 Nh6 10. exf6 gxf6 11. Kc1 Bd6 12. h4 Rg8 13. g3 Ng4 14. Rg1 Kc7 15.
Bd3 Qf7 16. Na4 b6 17. Nc3 a6 18. Kb1 a5 19. Rg2 Ba6 20. Rg1 Rae8 21. Rg2 h6
22. h5 b5 23. Bxb5 cxb5 24. Nxb5+ Kc6 25. Nc3 e5 26. Rg1 Nb6 27. Rg2 e4 28.
Nd2 a4 29. b3 Bb4 30. Nf1 f5 31. Nxa4 Nxa4 32. bxa4 Rb8 33. Kc1 Bc4 34. Kb2
Bd6+ 35. Ka3 Qe6 36. c3 Rg7 37. Rg1 Ra7 38. Bc5 Ra5 39. Rh1 Rba8 40. Kb3
Rxa4 41. a3 R4a6 42. Kc2 Rb6 43. Rh4 Rab8 44. Nd2 Rb2+ 45. Kc1 R2b7 46. a4
Ra8 47. Ra3 Rb6 48. a5 Rba6 49. Nb3 Rb8 50. Be3 Qd7 51. Nc5 Ra7 52. Nb3 Rb5
53. Bc5 Ra8 54. Kc2 Kb7 55. Be3 Qc6 56. Bc5 Kc7 57. Ra1 Rb7 58. Nd2 Qb5 59.
f3 exf3 60. Nxf3 Re8 61. Qd2 Kc6 62. Rg1 Re2 63. Rh3 Rb8 64. Rf1 Qa4 65. Ng1
Rg2 66. Nf3 Qb3+ 67. Kc1 Rb5 68. Nh4 Rf2 69. Rxf2 Nxf2 70. Rh2 Nd3+ 71. Kb1
f4 72. gxf4 Bxf4 73. Rh3 Qa2+ 74. Kc2 Nxc5 75. dxc5 Bxd2 76. Kxd2 Kxc5 77.
Nf5 Rxa5 78. Nxh6 Qb3 79. Nf5 Ra2+ 80. Ke3 Re2+ 81. Kf3 Rc2 82. Kg4 Be6+ 83.
Kf4 Kc4 84. Ne3+ Kxc3 85. Nxc2+ Kxc2 86. Ke5 Bc4 87. h6 Be2 88. Kxd5 Qc4+
89. Kd4 Kd2 90. Ra3 Kc1 91. Rc3+ Kd2 92. Rxc4 Bxc4 93. Kxc4 Ke3 {White wins}
1-0

Here is a somewhat better game from some years later:

[Event "ICC w28 3 3 u"]
[Site "Internet Chess Club"]
[Date "2005.11.23"]
[Round "-"]
[White "Zayats71"]
[Black "G2K"]
[Result "0-1"]
[ICCResult "White checkmated"]
[WhiteElo "2255"]
[BlackElo "2128"]
[Time "21:07:18"]
[TimeControl "180+3"]
[Variant "Shatranj"]
[SetUp "1"]
[FEN "rnbkqbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBKQBNR w - - 0 1"]

1. e3 e6 2. d3 d6 3. c3 f6 4. Kc2 c6 5. e4 e5 6. Be3 d5 7. Nd2 Be6 8. f3 Bd6
9. b3 d4 10. cxd4 exd4 11. Bc5 b6 12. Ba3 a6 13. g3 Bb4 14. Nb1 Ne7 15. Bc1
a5 16. a3 a4 17. axb4 axb3+ 18. Kb2 Rxa1 19. Kxa1 Na6 20. Kb2 Nxb4 21. Kxb3
c5 22. Ne2 Nec6 23. Ba3 Qd7 24. Qd2 g6 25. h3 h6 26. Nf4 Ne5 27. h4 Re8 28.
Qc1 h5 29. Qb2 Qc6 30. Nd2 Na6 31. Bh3 b5 32. Ra1 c4+ 33. Kc2 Nb4+ 34. Kb1
cxd3 35. Bc5 Kc7 36. Nb3 Nxf3 37. Nxg6 Rg8 38. Ne7 Rxg3 39. Ra7+ Kb6 40. Bf5
Rg1+ 41. Qc1 d2 42. Kb2 dxc1=Q+ 43. Nxc1 Nd2 44. Ne2 Nc4+ 45. Kb3 Rb1#
{White checkmated}
0-1

It was never a terribly strong Shatranj engine. The "2K" in the handle G2K didn't refer to the year but to the goal -- an engine that could play everything with a 2000 rating. It failed miserably in a couple of cases, and did far better in others. The Shatranj probably did end up somewhat over 2000, at least in terms of ICC ratings.

It is not a winboard engine though; all it could do was connect to ICC and play there.

My recent coding is intended to be the beginnings of a brand new engine, although progress is glacially slow. It is intended to be stronger though and will play less variants.
ibid
Posts: 89
Joined: Mon Jun 13, 2011 12:09 pm

Re: Shatranj perfts

Post by ibid »

There are 35,675,112,788 unique positions at 12 ply and perft 15 is 7,624,775,065,359,813,289. Perft 16 would take over 40 days, so I think I'll stop here.