Computer Chess Club Archives


Search

Terms

Messages

Subject: Need help understanding Null Move please

Author: Ryan B.

Date: 18:52:37 05/08/03


My search look something like this :

for(imove=nextMoves->begin(); (best<beta)&&imove<nextMoves->end(); imove++)
    {
        ply++;
        p->doMove(*imove);
        if(best>alpha) alpha=best;
        if (fFoundPv) {
            value = -AlphaBeta(depth - 1, -alpha - 1, -alpha);
            if ((value > alpha) && (value < beta))
            value = -AlphaBeta(depth - 1, -beta, -alpha);
        } else
        value=-alphabeta(p,depth-1,-beta,-alpha);
        ply--;
        if(value>alpha) fFoundPv=TRUE;
        if(value>best)
        {
            best=value;
            bestMove=*imove;
            pv[ply][ply]=(*imove);
            for(int j=ply+1;j<pv_length[ply+1];j++)
                pv[ply][j]=pv[ply+1][j];
            pv_length[ply]=pv_length[ply+1];
        }
        p->undoMove(*imove);
    }

    return best;

I have been reading Bruce Moreland's web site and seem to be having trouble
understanding how a null move works and how to implement it.  To my
understanding the updated code for the search would look something like this?
However in my mind it seams doubtful that I understand it properly.

p->doNullMove(*imove);
value = -AlphaBeta(depth - 3, -beta, -beta + 1);
p->undoNullMove(*imove);
if (value >= beta)
return beta;

for(imove=nextMoves->begin(); (best<beta)&&imove<nextMoves->end(); imove++)
    {
        ply++;
        p->doMove(*imove);
        if(best>alpha) alpha=best;
        if (fFoundPv) {
            value = -AlphaBeta(depth - 1, -alpha - 1, -alpha);
            if ((value > alpha) && (value < beta))
            value = -AlphaBeta(depth - 1, -beta, -alpha);
        } else
        value=-alphabeta(p,depth-1,-beta,-alpha);
        ply--;
        if(value>alpha) fFoundPv=TRUE;
        if(value>best)
        {
            best=value;
            bestMove=*imove;
            pv[ply][ply]=(*imove);
            for(int j=ply+1;j<pv_length[ply+1];j++)
                pv[ply][j]=pv[ply+1][j];
            pv_length[ply]=pv_length[ply+1];
        }
        p->undoMove(*imove);
    }

    return best;

In doNullMove(*imove) I am just updating some flags and switching the player.
My guess is that it isn't just this simple and I'm missing the point all
together.  Bruce Moreland's web site does a good job explaining thing I'm just a
bit slow.  Please help.

Ryan



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.