Which perft result is correct (and why)?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Which perft result is correct (and why)?

Post by sluijten »

Finally have set up my Visual C+ Express to target for x64,
Perft gets a boost of 1.68x, comparing 32-bit mode with 64-bit mode, cool.
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Which perft result is correct (and why)?

Post by sluijten »

bob wrote:perft 7 from starting position: total moves=119060324 time=5.44
total moves=119060324 , isn't that perft 6?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Which perft result is correct (and why)?

Post by bob »

sluijten wrote:
bob wrote:perft 7 from starting position: total moves=119060324 time=5.44
total moves=119060324 , isn't that perft 6?
Yes, "7" was next to "6" and in the dark... :)
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Which perft result is correct (and why)?

Post by sluijten »

Just out of curiosity, on what CPU do you get this speed?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Which perft result is correct (and why)?

Post by bob »

sluijten wrote:Just out of curiosity, on what CPU do you get this speed?
This is an intel core-2 duo laptop, 2.53ghz, P9600. Nothing particularly "magic" as there are many much faster processors around...

Machine is a Dell Lattitude E4300
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Which perft result is correct (and why)?

Post by sluijten »

Hmmmm, you have programmed perft as a single thread (me too). My engine's perft 6 takes 11.7 seconds, running on an i3 M330 (2.13 GHz), which is only slightly slower than yours (not a factor 2).
- bitboards
- magics for ranks, files, and diagonals (so I need 4 multiplications for a queen)
I'll have to dig into this...
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Which perft result is correct (and why)?

Post by sluijten »

Just added another perft test position here, #see 4. Not invented by me, but just thought it's a good one to keep for the records. Any volunteers to check my results? Or add the checkmate counts? (my perft doesn't count them).
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

#4

Post by sje »

[D]r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1

Code: Select all

Depth: 1   Count: 6
Depth: 2   Count: 264
Depth: 3   Count: 9,467
Depth: 4   Count: 422,333
Depth: 5   Count: 15,833,292
Depth: 6   Count: 706,045,033
Depth: 7   Count: 27,209,691,363
Depth: 8   Count: 1,209,257,875,296
Mark
Posts: 216
Joined: Thu Mar 09, 2006 9:54 pm

Re: #4

Post by Mark »

sje wrote:[D]r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1

Code: Select all

Depth: 1   Count: 6
Depth: 2   Count: 264
Depth: 3   Count: 9,467
Depth: 4   Count: 422,333
Depth: 5   Count: 15,833,292
Depth: 6   Count: 706,045,033
Depth: 7   Count: 27,209,691,363
Depth: 8   Count: 1,209,257,875,296
I got the same results through depth 7. Took almost 4 hours!
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Which perft result is correct (and why)?

Post by elcabesa »

sluijten wrote:Hmmmm, you have programmed perft as a single thread (me too). My engine's perft 6 takes 11.7 seconds, running on an i3 M330 (2.13 GHz), which is only slightly slower than yours (not a factor 2).
- bitboards
- magics for ranks, files, and diagonals (so I need 4 multiplications for a queen)
I'll have to dig into this...
I'm playing with your code in Linux, I got your code compiling under Linux with few modification.

besides that i'm playing with your code to make it run faster. With my compiler (gcc) i got a big boost modifying move.c and move.h, setting all the move.h function (e.g. setFrom etc..) to inline gave me a +50%boost.

the original code took on my pc 29 seconds to compute perft 6, while the modified one took only 20 seconds. (maybe your compiler already set them inline automatically and you'll got no boost at all)

A big problem for your code to be fast is the fact you use a lot of "if" and "switch", I still don't know how to solve the problem, ( i'll dig inside it next days) ,but for example Stockfish has not a bitmap for every piece ( whiteking, white rook, etc,) instead it has a bitmap array indexed by piece type, this should remove a lot of if in you code!

I'm very interested in you code, and i'm learning a lot from it, good luck[/code]