Computer Chess Club Archives


Search

Terms

Messages

Subject: TSCP with bitboards

Author: Russell Reagan

Date: 23:04:23 06/01/03

Go up one level in this thread


On June 01, 2003 at 23:41:58, Jean Efpraxiadis wrote:

>If the location of each piece of the board was stored in a array and updated in
>make and unmake move, so that the move generator could use these locations
>instead of taking the board square by square, that would be fine. I am not
>looking for a bitboard implementation of TSCP. I doubt someone took the trouble
>to modify TSCP that way. Anyway, a version of TSCP with hash tables would do
>still do it for me. The rest I am willing to do myself if I have to.

I didn't mean to redo the entire thing in bitboards. I think it would be much
simpler and easier to use two bitboards as "piece lists" and work with those, as
opposed to working with an array and updating that (which gets tricky if you're
not careful.

Since I was bored and tired of working on my own program for today, I made a few
changes to TSCP to support piece lists in this way, using bitboards. The basic
idea is that I replaced the loop over the whole board:

for (i = 0; i < 64; i++) {
    // code goes here...
}

With this (hope you understand how bitboards work):

/* Bitboard occupied[2]; */

Bitboard pieces = occupied[side];
while (pieces) {
    i = SomeBit(pieces); // Get the index of some bit (doesn't matter which)
    pieces ^= MASK(i);   // Clear the bit
    // code goes here...
}

You can find the code that I made changes to at
http://home.attbi.com/~rreagan/tscp_bb.zip

Any changes I made are commented in one of the following ways:

/* BEGIN BITBOARD STUFF */
// ...
/* END BITBOARD STUFF */

/* BITBOARD STUFF ADDED */
/* STUFF REMOVED */

I changed every loop over the entire board in board.c and eval.c and it runs 13%
faster now (according to nps and time, using the 'bench' command). Maybe an
array based piece list would be faster, but this seems easier, at least to me.

I also got different node counts when I ran the 'bench' command with the new
version, so there might be a bug somewhere, but as far as testing the speed gain
I think it's fairly accurate.



This page took 0.05 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.