Author: Scott Gasch
Date: 21:26:17 11/15/99
Hi,
I have been rewriting my engine from the ground up and trying to "do it right"
this second go 'round. For instance, I pruned the move data struct from a huge
56 byte struct down to an int to increase performance ;)
I have recently been doing Vincent Diepeveen's test of move generation speed to
clock how fast my generator is. In the prior version it generated at about 3
million nodes/sec whereas in this version (with the much smaller move
representation) it is up to about 6 million nodes/sec on my AMD K6-3 450.
Vincent's test is to generate all successors of:
rnbqkbnr/ppp2ppp/8/3pp3/3PP3/8/PPP2PPP/RNBQKBNR b KQkq e6 0 0
in a loop, 2000000 times and keep track of how long it takes... then compute
nodes/sec. Vincent gets 15 million in the same position with a slower
processor!
I have profiled my code and determined that the bottleneck is in my generation
routines (as opposed to AddMove) So my question is this: I currently generate
moves for a specific piece something like this:
//
// Figure out how the rook can move.
//
for (iDir = 0; iDir < 4; iDir++)
{
iTarg = x + iDelta[iDir];
while (ONBOARD(iTarg))
{
iTargContents = PIECE_AT(psPos, iTarg);
//
// The rook can move if the square is empty.
//
if (IS_EMPTY(iTargContents))
{
AddMove(psPos, x, iTarg);
}
//
// Or if there is an enemy piece there to capture.
//
else
{
if (COLOR(iTargContents) != COLOR(iRook))
{
AddMove(psPos, x, iTarg);
}
break;
}
iTarg += iDelta[iDir];
}
}
However I see in GNUChess they use some kind of precomputed table. I am not
sure I understand exactly how this works. Also, does anyone else have any other
tricks to speed up move generation? I know that in the long run this really
doesn't make TOO much of a difference but I want my new version to be lean and
mean...
As always, I appreciate the help.
Scott
This page took 0.02 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.