Author: James Swafford
Date: 20:40:22 10/05/99
Go up one level in this thread
On October 05, 1999 at 12:00:19, Robert Hyatt wrote: >I have finished writing a paper for the JICCA on the rotated bitmap approach >to chess... although it includes traditional (non-rotated) bitmaps as well >since an understanding of them is necessary to appreciate rotated bitmaps. > >There is very little literature to reference, excepting the paper in the >old Chess Skill in Man and Machine book, so I thought that I would at least >mention the names of current (and past, such as Kaissa) programs that are or >did use bitboards. > >If you are using them, either post the particulars here (name of program, >author, affiliation [if any], and so forth) and I'll include it. > >Thanks... > >Bob Tristram (3.xx and 4.xx), which is retired, and Galahad, which is private. Both use rotated bitboards. Galahad uses a C++ implementation. I've attached the bitboard.h header and functions for deriving the rook, bishop, and queen movement boards below. I learned about bitboards, and rotated bitboards, from studying the Crafty source. I've written a beginner's level "how to" based on what I have learned about bitboards and rotated bitboards. Both are at http://members.xoom.com/jswaff/chessprg/. Sorry... I will be leaving in the morning for nine or ten days. Please replicate any responses to my email address. I may or not have web access while I am away, but I will have email access. -- James // // bitboard.h // James Swafford // Galahad // #ifndef __BITBOARD__ #define __BITBOARD__ #include "types.h" class BitBoard { public: BitBoard() { m_data = 0; } BitBoard(const uint64 val) { m_data = val; } int MSB(); int LSB(); void Set() { m_data = 0; } void Set(const uint64 num) { m_data = num; } void Set(const BitBoard &b) { m_data = b.Data(); } void Or(const BitBoard &b) { m_data |= b.Data(); } void Or(const uint64 n) { m_data |= n; } void And(const BitBoard &b) { m_data &= b.Data(); } void And(const uint64 n) { m_data &= n; } void Xor(const BitBoard &b) { m_data ^= b.Data(); } void Xor(const uint64 n) { m_data ^= n; } uint64 Data() const { return m_data; } void Random(); int operator == (const BitBoard &b) { return (b.Data() == m_data); } int operator != (const BitBoard &b) { return (b.Data() != m_data); } BitBoard operator | (const BitBoard &b) { return BitBoard(m_data | b.Data()); } BitBoard operator & (const BitBoard &b) { return BitBoard(m_data & b.Data()); } BitBoard operator ^ (const BitBoard &b) { return BitBoard(m_data ^ b.Data()); } BitBoard operator << (const int i) { return BitBoard(m_data << i); } BitBoard operator >> (const int i) { return BitBoard(m_data >> i); } BitBoard operator ~ () { return BitBoard(~m_data); } private: uint64 m_data; uint32 Random32(void); }; #endif BitBoard Rook(const Position *p,const int i) { return( rank[i][((p->WhitePieces() | p->BlackPieces()).Data() >>norm_shift[i]) & 0xff] | file[i][(p->Rot90L().Data() >>r90l_shift[i]) & 0xff] ); } BitBoard Bishop(const Position *p,const int i) { return ( diag_uldr[i][(p->Rot45L().Data() >>r45l_shift[i]) & r45l_mask[i]] | diag_urdl[i][(p->Rot45R().Data() >>r45r_shift[i]) & r45r_mask[i]] ); } BitBoard Queen(const Position *p,const int i) { return (Rook(p,i) | Bishop(p,i)); }
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.