Computer Chess Club Archives


Search

Terms

Messages

Subject: Node counting. Do I update at A, B, C, D or E ?

Author: Mikael Bäckman

Date: 10:15:30 05/13/03


Hi,

I'm trying to reduce qsearch tree size in my engine. I've had many odd looking
results (from 10% to 99%), some of which I've tracked down to bugs in
nodecounting (maybe!).

Where is the proper place to update the node counts? A, B, C, D or E?

In the below code, A and B is of course replaced with "nodes++" and C, D, E with
"qnodes++";

And of course the code is incorrect, only the placement of A, B, C, D and E
matters here.


int alphaBeta(int alpha, int beta, int depth)
{
	/* A */
	if (depth < 0) {
		score = qsearch();
		return score;
	}
	/* B */
	nMoves = genAllMoves();
	while (i < nMoves) {
		makeMove(move[i]);
		score = alphaBeta(-beta, -alpha, depth - 1);
		unMakeMove(move[i++]);
	}
}


int qsearch(int alpha, int beta)
{
	/* C */
	score = evaluate();
	if (score > alpha) {
		if (score > beta) return score;
		alpha = score;
	}
	/* D */
	nMoves = genAllCaptureMoves();
	while (i < nMoves) {
		makeMove(move[i]);
		/* E */
		score = qsearch(-beta, -alpha);
		unMakeMove(move[i++]);
	}
}



Thanks,

Mikael



This page took 0.22 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.