Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Nodes per Second - What does it include ?

Author: Bruce Moreland

Date: 09:52:13 02/01/99

Go up one level in this thread



On February 01, 1999 at 06:27:55, Andrew Wood wrote:

>When someone quotes a comparitive speed rating in nodes per second, what exactly
>does that usually include ?
>
>Is it :
>a) Generating, doing and undoing moves at non-terminal nodes
>...or...
>b) Evaluating the terminal node positions using a SEF.
>...or...
>c) (a) + (b).
>...or...
>d) something else.
>
>TIA.
>
>...Andrew...

On page 52 of "Advances in Computer Chess 3", Ken Thompson defined a normal
chess program for all eternity.

His code essentially went like this, and typos are mine, please:

int search(alpha, beta, n)
{
    // Node counter increment here.
    // Hash table probe here.
    if (no_moves())
        if (in_check())
            return MATE;
        else
            return DRAW;
    if (!in_check())
        n = n - 1;
    while (next_move()) {
        make_move();
        if (n > 0)
            v = -search(-beta, -alpha, n);
        else
            v = -quies(-beta, -alpha);
        restore_move();
        if (v > alpha) {
            if (v >= beta)
                return beta;
            alpha = v;
        }
    }
    return alpha;
}

int quies(alpha, beta)
{
    // Node counter increment here.
    // Hash table probe here, if you do quiescent hashing.
    if (in_check())
        return search(alpha, beta, 0);
    if (fast_eval() - MARGIN >= beta)
        return beta;
    v = slow_eval();
    if (v > alpha) {
        if (v >= beta)
            return beta;
        alpha = v;
    }
    while (next_capture()) {
        make_move();
        v = -quies(-beta, -alpha);
        restore_move();
        if (v > alpha) {
            if (v >= beta)
                return beta;
            alpha = v;
        }
    }
    return alpha;
}

I have marked where the node counter should be incremented, and where hash table
probes would typically be done..  I think that if someone wants to change the
above around, as long as the node counts is preserved, it's fine.

For example, someone might decide that they only want to probe the hash table in
quiescent nodes at the root of the quiescent search.  An efficient means of
doing this would be to probe the table before "search" calls "quies".  Even
though you never made it to "quies", I think it would be fine to increment the
node counter there, because you could easily write it so that it went into
quies, incremented the node count, and did a hash probe if a boolean parameter
you passed in to "quies" was set.

As long as you do some work on a node it's fine to count it, but I don't think
it is fine to count all moves generated by a "legal moves only" move generator,
or to count moves you didn't look at because you cut off in some tricky fashion.

This is all a matter of definitions, and none of this changes program strength,
but if people are going to compare programs, they should compare them fairly.

bruce




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.