Author: Dieter Buerssner
Date: 14:18:03 05/12/04
Go up one level in this thread
On May 12, 2004 at 14:05:30, Pallav Nawani wrote:
>Hello,
>
>I am trying to implement NULL move heuristic in my chess program, Natwarlal.
>Addition of null move reduces the number of nodes drastically, but it leads to
>the program making stupid captures. For instance, capturing a pawn by a bishop
>when the pawn is well defended. What should I do to avoid this problem?
>
>The code I use follows:
>(gi is the structure used to hold moves, undo stack, etc.)
>
> // Lets try a NULL move
> if(!avoidnull
> && !gi.uptr->incheck
> && gi.ply > 1) {
>
> make_null_move(gi);
> if(depth - NULLRED > 0)
> score = -search(gi, -beta, -alpha, depth - NULLRED);
> else
> score = -qsearch(gi, -beta, -alpha);
> undo_null_move(gi);
> if(score >= beta) {
> return beta;
> }
> }
At first sight, this looks all ok to my eyes. I assume your make_null_move does
some things behind the scenes (like updating gi.ply). One might also want to
know, when and how you set avoidnull. This seems to be a global (or static) var.
When using such a global var in a recursive function, special care must be taken
(do you really always set and reset it correctly?). A parameter to the search
function would look more natural to me for avoidnull.
One minor point. The search after doing the null move wants only to prove if the
score is >= beta or < beta. Window -beta, -beta+1 (instead of -alpha) is enough
for this, and should i general be more efficient.
Sorry, all this can probably not explain what you see.
Good luck for finding the problem,
Dieter
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.