Computer Chess Club Archives


Search

Terms

Messages

Subject: speed in multithreaded chess programs

Author: Sean Mintz

Date: 16:44:57 01/23/02


A friend am I have been working together on an engine. Both of us are very
interested in the idea of multithreaded chess programs. We are now developing
ours with Cilk, seeing as how we thought it would be the most painless
transition.

The new version is almost identical to the last version, except now we pass
positions around and copy boards (which is obviously eating up a lot of time).

Here is our perft function:

unsigned int perft(Position * board, int depth) {
        Position perft_board;
        Move_Stack moves[MAX_MOVES];
        int num_moves,
            i;
        unsigned int nodes;

        if (depth <= 0) {
                return 0;
        }

        num_moves = 0;
        nodes = 0;

        gen(board, &moves[0], &num_moves);

        for (i=0; i<num_moves; i++) {
                perft_board = copy_board(board);

                if (make_move(&perft_board, moves[i].m)) {
                        if (depth == 1) {
                                nodes++;
                        }

                        nodes += perft(&perft_board, depth - 1);
                }
        }

        return nodes;
}

What do people do to keep their programs fast?



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.