Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: General Tips and Tricks for debugging a search.

Author: Daniel Mehrmannn

Date: 07:42:00 06/16/05

Go up one level in this thread


On June 15, 2005 at 16:36:54, Eric Oldre wrote:

>
>I was wondering if anyone would like to volunteer any tricks they've
>used to help find certain bugs in their search function.
>
>I think that the ideas of using perft for move generation and
>reversing the board to find bugs in the evaluation have both
>been really useful to me. I was wondering if anyone has used
>techniques similar to these to help find search bugs.
>
>I understand that just because a engine can properly pass these
>and other tests doesn't mean it's free of bugs. But they certainly
>help detect at least some of them.
>
>I'm certain that there must be plenty of bugs in Latista's search
>and I think it's time for me to work on discovering them. If
>you don't have any automated tricks like above. Does anyone
>have any general advise to help me spot some bugs?
>
>Eric Oldre
>
>PS. I have at various spots in my program tried to follow a similar
>model of asserts as in fruit. I'm sure taking some time to
>do this at more parts of my program would help.


I suggest that you use such function too and call them with a va_list:


BOOL
CheckBoard(void)
{
    uint32 i, wKing, bKing;
    gameData_t *mgdPtr = &gameData;
    char buffer[STD_BUFF];

    for (i = 0; i < 64; i++)  {
        switch (mgdPtr->piece[i]) {
            case W_PAWN:
            case B_PAWN:
            case W_KNIGHT:
            case B_KNIGHT:
            case W_BISHOP:
            case B_BISHOP:
            case W_ROOK:
            case B_ROOK:
            case W_QUEEN:
            case B_QUEEN:
                continue;

            case W_KING:
                wKing++;
                continue;

            case B_KING:
                bKing++;
                continue;

            case EMPTY:
                continue;

            default:
                sprintf(buffer, "Unkown Piece %d on Square %d. node = %lu\n",
                         mgdPtr->piece[i], i, mgdPtr->nodes);
                LogIntern(buffer);
                printf("%s", buffer);
                showCurrentLine();
                return FALSE;
        }
    }

    if (!wKing) {
        sprintf(buffer, "no white King found !\n");
        LogIntern(buffer);
        printf("%s", buffer);
        return FALSE;
    }

    if (!bKing) {
            sprintf(buffer, "no black King found !\n");
            LogIntern(buffer);
            printf("%s", buffer);
            return FALSE;
    }

    return TRUE;
}

daniel



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.