Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Attack Bitboards

Author: Robert Hyatt

Date: 10:29:38 10/31/01

Go up one level in this thread


On October 30, 2001 at 10:57:07, Sune Fischer wrote:

>On October 30, 2001 at 10:32:44, Gerd Isenberg wrote:
>
>>Sample C++ code:
>>
>>
>>void CNode::MovePiece(unsigned int from, unsigned int to, unsigned int piece)
>>{
>>	// occupied bitboard updates
>>	m_Inc.m_OccuBBA1H8 ^= sBits[from].sA1H8 ^ sBits[to].sA1H8;
>>	m_Inc.m_OccuBBH1A8 ^= sBits[from].sH1A8 ^ sBits[to].sH1A8;
>>	m_Inc.m_OccuBB90   ^= sBits[from].sBt90 ^ sBits[to].sBt90;
>>	m_Inc.m_PieceBB[ALLPIECES] ^= sBits[from].sBBit ^ sBits[to].sBBit;
>>	// piece bitboard updates
>>	m_Inc.m_PieceBB[piece>>1] ^= sBits[from].sBBit ^ sBits[to].sBBit;
>>	m_Inc.m_ColorPieceBB[ColorOfPiece(piece)] ^= sBits[from].sBBit ^
>>sBits[to].sBBit;
>>	// hash update
>>	m_Inc.m_Pos.m_Hashval ^= sHashvtbl[piece][from] ^ sHashvtbl[piece][to];
>>}
>>
>>...
>
>Just out of curiosity;  You only use 2D arrays in your hash update?
>Can you ignore the color or is that "object oriented" into it somewhere?
>Else I would be worried, for instance in a rook endgame where the rooks can
>"easily" transpose.
>

"piece" should include the color.  IE I have 12 random numbers for each square,
one for each type of piece (which includes black and white as separate piece
types).

>
>>__forceinline BitBoard FileAttacks(unsigned int sq) const
>>{
>>	return sFileAtta[sq][(*(((BYTE*)&(m_Inc.m_OccuBB90))+File(sq)) >> 1) & 0x3f];
>>}
>
>File(sq) ?
>
>-S.



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.