Computer Chess Club Archives


Search

Terms

Messages

Subject: Nullmove problem

Author: Michel Langeveld

Date: 15:23:08 11/21/01


I build nullmove in my chessprogram and received a problem.

The example which is on Bruce side seems not to work in certain positions.
Especially positions where it's possible to give mate:

[D] rnbq1bnr/pp2k3/2p1p1B1/3pP1p1/7p/4PQ2/PPPN1PPP/R3K1NR b KQ

After Qc7 white doesn't see Qf7 anymore.

It seems to be that the line:

val = -AlphaBeta(depth - 1 - R, -beta, -beta + 1);

Must be changed into:

val = -AlphaBeta(depth - 1 - R, -beta+1, -beta);


--------- BELOW HERE THE EXAMPLE OF BRUCE ---------------

#define R   2



int AlphaBeta(int depth, int alpha, int beta)
{
    if (depth == 0)
        return Evaluate();
    MakeNullMove();
    val = -AlphaBeta(depth - 1 - R, -beta, -beta + 1);
    UnmakeNullMove();
    if (val >= beta)
        return beta;
    GenerateLegalMoves();
    while (MovesLeft()) {
        MakeNextMove();
        val = -AlphaBeta(depth - 1, -beta, -alpha);
        UnmakeMove();
        if (val >= beta) // Delete these to get straight
            return beta; // min-max instead of alpha-beta.
        if (val > alpha)
            alpha = val;
    }
    return alpha;






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