Author: Mikael Bäckman
Date: 05:22:20 08/14/03
Go up one level in this thread
On August 14, 2003 at 02:27:40, Rick Bischoff wrote:
>Hi everyone,
>
>In my latest exercise in futility, I am coding different Board/Move generation
>schemes and was wondering what raw move generation scores you get. Let's define
>"raw move generation" as follows:
>
>1) All piece moves
>2) No special moves (castling, en passant) pawn promotions are not special.
>
>And then define the following coroutines:
>
>int wmetaperft(Board, depth) {
>-- if (depth == 0) return 1;
>--else {
>---nodes = 0
>---generateMoves for White
>---For each Move M,
>----makeMove M
>----nodes += bmetaperft(B, depth - 1)
>----unmakeMove
>---End for
>---return nodes
>
>int bmetaperft(Board, depth) {
>-- same as white, except generate black moves
>--- and call wmetaperft recursively.
>
>
>Ok, so we are doing no check detection, etc. No matter what I try, I can never
>go much higher than 6 million nodes/sec (on a Athlon 1.4Ghz, I only get 3
>million on my G4) as defined by the routines above. Am I reaching an upper
>limit on memory bandwidth (the moves are all encoded as integers...) or is there
>room for improvement (i.e., how does this compare to your best)?
>
>Thanks,
>Rick
Hi,
6 million nodes/s doesn't sound bad at all to me.
I'm at work now, so the code below is almost what I use for testing..
generateAllMoves() generates all moves including castle and en passant.
MakeMove() prevents illegal moves from being tried and it also updates hashkeys,
material scores and other stuff such as the ep square. All the modified data is
copied to nodeData[ply+1], so there is quite a lot of memory access which slows
it down.
int nMoves;
void perft(int depth)
{
move *pMove, *pLast;
if (!depth) return;
pMove = nodeData[ply].pFirst;
nodeData[ply+1].pFirst = pLast = generateAllMoves(pMove);
while (pMove < pLast) {
if(makeMove(pMove)) {
nMoves++;
perft(depth-1);
}
pMove++;
}
}
On an athlon 1266 I get around 2.5 MLN moves/s from the starting position.
For testing the movegenerator only I use something like:
#define N 2000000
pLast = generateAllMoves(pFirst);
int nTotal = (pLast - pFirst) * N;
startTimer();
for (i = 0; i < N; i++) {
pLast = generateAllMoves(pFirst);
}
endTimer();
which gives me about 8.5 MLN moves/s.
/Mikael
This page took 0 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.