Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: [Somewhat Off Topic] Checkers program move respresentation

Author: David Eppstein

Date: 11:21:54 01/24/00

Go up one level in this thread


Something I do in a similar game (Fanorona) is to represent a move by a bitboard
of changed squares.  Then (if say red was to move) you can update your other
bitboards (I'm assuming you have three per side, one for occupied, one for
pawns, and one for kings -- I know this is redundant but all three are useful
and it helps in the computation) by:

    blackPawns &=~ move;
    blackKings &=~ move;
    move &=~ blackOccupied;
    blackOccupied = blackPawns | blackKings;
    if (move & redPawns) {
        if (move & lastRow) { /* king me! */
            redPawns &=~ move;
            move &=~ redOccupied;
            redKings |= move;
        } else redPawns ^= move;
    else redKings ^= move;
    redOccupied = redPawns | redKings;

If you're using 32-bit bitboards, this might not even be too wasteful of
space... It's a little bit of a pain to convert these things to human-readable
notation but you shouldn't be doing huge quantities of i/o so that shouldn't
slow down your program.



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.