Which perft result is correct (and why)?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

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

Post by elcabesa »

another example could be the following:

in the isAttacked(BitMap &targetBitmap, const unsigned char &fromSide) function, commenting

Code: Select all

//if (slidingAttackers)
give the program a 1% speedup
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

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

Post by sluijten »

elcabesa wrote: 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]
I did verify this using macro's for the moves on my machine, without improvement. So I think my compiler (option /O2, max speed) is inlining. These functions are just 1 line of bitmasking & shifting.

But I am a still looking for ways to improve. Not sure if a bitmap array will be much faster than the switches.