Author: Matthias Gemuh
Date: 14:17:18 03/16/04
Go up one level in this thread
On March 16, 2004 at 16:56:02, Volker Böhm wrote:
>
>>r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1
>>PerftPly = 4
>>nCount = 4185552
>>nps = 1260708
>
>I gave this one a try as it has a some nodes to get an accurate time
>measurement.
>Ralf (Cheetah) and me (IceSpell) just startet to "play" with different kind´s of
>move generators and we have built one from the scratch.
>It takes about 1sec (1081 ms) for 4085603 nodes (only depth 4 perft not the sum
>of depth 1-4). The CPU is a 1,3 GHZ Celeron which should be about 1,5-1,6 times
>less fast than yours (for chess).
>But we don´t have fully built attack-tables, only with pawns, knights and kings
>now (those were simple to implement).
>
>How do you build your attack-tables? incrementally? What is the data-structure
>for them?
typedef struct {
BITBOARD PieceAttacks[2][7];
BITBOARD HashKey, SlidingAtcks[2], AttacksFrom[64], AttackDefence[2];
unsigned short nAttackInfo, nAllPieceCnt[2], KingSq[2], nPieceCnt[2][7];
} ATTACKENTRY;
incrementally ? No, because I would need AttacksTo[64].
bool CalculateAttackBoards(CHESSSTRUCT *ChsStrct, ATTACKENTRY *AtkInfo)
{
register int k, a, s, t, nTo, nSide, nOther, nPieceNr, nOtherKingSq;
register BITBOARD pieses, moves, BitS, BitAll=0, BitA=0, BitB=0;
if (!AtkInfo) return(false);
AtkInfo->nAttackInfo = 0;
AtkInfo->KingSq[0] = FindKing(ChsStrct, 0); AtkInfo->KingSq[1] =
FindKing(ChsStrct, 1);
for (nSide=0; nSide<2; nSide++) {
nOther = ChangeSide(nSide);
AtkInfo->AttackDefence[nSide] = 0; AtkInfo->SlidingAtcks[nSide] = 0;
AtkInfo->nAllPieceCnt[nSide] = 0;
if (nSide==0) for (int i=0; i<64; i++) { AtkInfo->AttacksFrom[i] = 0; }
AtkInfo->atk_tropism[nSide] = 0; nOtherKingSq = AtkInfo->KingSq[nOther];
for (int i=0; i<7; i++) {
AtkInfo->PieceAttacks[nSide][i] = 0;
AtkInfo->nPieceCnt[nSide][i] = 0;
}
pieses = ChsStrct->ChsPos.occupied[nSide];
while (pieses) {
k = xxFirstOne(ChsStrct, pieses); Klear(k, pieses);
nPieceNr = ChsStrct->ChsPos.PieceOnSq[k];
AtkInfo->nPieceCnt[nSide][nPieceNr] += 1;
AtkInfo->nAllPieceCnt[nSide] += 1;
switch (nPieceNr) {
case pawn :
BitB = AtkInfo->AttacksFrom[k] =
ChsStrct->MvsAtk.PawnAttacks[nSide][k]; break;
case knight :
BitB = AtkInfo->AttacksFrom[k] =
ChsStrct->MvsAtk.KnightMoves[k]; break;
case king : BitB = AtkInfo->AttacksFrom[k] =
ChsStrct->MvsAtk.KingMoves[k]; break;
case bishop : BitB = AtkInfo->AttacksFrom[k] =
diagAttacks(ChsStrct, k);
AtkInfo->SlidingAtcks[nSide] |= BitB; break;
case rook : BitB = AtkInfo->AttacksFrom[k] =
rankFileAttacks(ChsStrct, k);
AtkInfo->SlidingAtcks[nSide] |= BitB; break;
case queen : BitB = AtkInfo->AttacksFrom[k] =
((diagAttacks(ChsStrct, k)) | (rankFileAttacks(ChsStrct, k)));
AtkInfo->SlidingAtcks[nSide] |= BitB; break;
default: BitB = 0; break;
}
AtkInfo->PieceAttacks[nSide][nPieceNr] |= BitB;
AtkInfo->AttackDefence[nSide] |= BitB;
}
}
AtkInfo->nAttackInfo = 1;
return(true);
}
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.