Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: simple bitboard program--a suggestion

Author: Brian Richardson

Date: 12:38:32 01/14/99

Go up one level in this thread


On January 08, 1999 at 18:03:09, Robert Hyatt wrote:

>On January 08, 1999 at 09:52:33, Frank Schneider wrote:
>
>>On January 08, 1999 at 08:57:49, Robert Hyatt wrote:
>>
>>>On January 08, 1999 at 03:39:49, Daniel wrote:
>>>
>>>>If any of you people have a simple chess program with bitboards in c I would
>>>>like to see the source code.
>>>>I have the source to crafty but I need a simple one.
>>>
>>>
>>>I'm afraid that the term "simple bitboard program" is an oxymoron...
>>>
>>>:)
>>>
>>>since "simple" is often another word for "short"...
>>Hi Daniel,
>>

I have been doing chess programs on and (mostly) off since 1971, and lurking
here for several months.  I am indebted to the work of many with freely
available source (GNU, Crafty, TSCP, et al).

In particular, I have done some limited testing of Crafty against various other
methods of move generation (on Pentium and PentiumII based platforms), including
make/unmake operations.

From the opening position (and in artificial positions with no pawns), removing
rotated bitmaps from Crafty does not seem to have a large negative impact vs the
fully bitmapped implementation.  Of course, there likely would be a significant
impact in the evaluation functions down the road...

Nonetheless, I would suggest starting off with "simple" non-rotated bitmaps
only.  As has been said, starting to develop a chess program on the cusp of
Intel IA-64 architecture (128 64bit registers plus pretty good optomizing
compilers) availability without bitmaps seems like a retrograde approach...

Even non-rotated bitmaps are very useful (with obstructed[][])and only a small
loop is needed for sliding piece generation.  It takes about a day to cut'n
paste the appropriate functions.  Make and unmake are dramatically simplified
(probably accounting for the tradeoff).

GenerateCaptures has trival modifications like:
    piecebd=WhiteQueens;
    while (piecebd) {
      from=LastOne(piecebd);
//      moves=And(AttacksQueen(from),BlackPieces);
      moves=And(queen_attacks[from],BlackPieces);
      temp=from+(queen<<12);
      while (moves) {
        to=LastOne(moves);
	if (!And(obstructed[from][to],Occupied))
		*move++=temp|(to<<6)|((-PieceOnSquare(to))<<15);
        Clear(to,moves);
      }
      Clear(from,piecebd);
    }

And Attacked has similar changes:
    attacks=And(b_pawn_attacks[square],WhitePawns);
    if (attacks) return(1);
    attacks=And(knight_attacks[square],WhiteKnights);
    if(attacks) return(1);
//    attacks=And(And(AttacksBishop(square),BishopsQueens),WhitePieces);
//    if(attacks) return(1);
//    attacks=And(And(AttacksRook(square),RooksQueens),WhitePieces);
//    if(attacks) return(1);
    attacks=And(king_attacks[square],WhiteKing);
    if(attacks) return(1);

    attacks=And(bishop_attacks[square],Or(WhiteBishops,WhiteQueens));
    while(attacks){
	from=FirstOne(attacks);
	if (!And(obstructed[square][from],Occupied)) return(1);
	Clear(from,attacks);
	}
    attacks=And(rook_attacks[square],Or(WhiteRooks,WhiteQueens));
    while(attacks){
	from=FirstOne(attacks);
	if (!And(obstructed[square][from],Occupied)) return(1);
	Clear(from,attacks);
	}
    return(0);
  }


>>I agree with Bob, but you could
>>try TSCP (Tom's Simple Chess Program), it has a 'Simple' in it's name ;-)
>>
>>See http://ucsu.Colorado.EDU/~kerrigat
>>
>>Frank
>
>
>yes... but Tom's program isn't based on "bitboards"...



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.