Author: Maurizio Di Vitto
Date: 08:24:18 01/27/04
Thank for your help.
I just want to receive some explanation about this part of code:
#ifdef USE_COMPACT_ATTACK_TABLES
# define AttackRank(s,o)
(((BitBoard)RookL00[(s)&7][((o)>>(((s)&~7)+1))&63])<<((s)&~7))
# define AttackFile(s,o) (RookL90[(s)>>3][((o)>>((((s)&7)<<3)+1))&63]<<((s)&7))
#else
# define AttackRank(s,o) (RookL00[s][((o)>>(((s)&~7)+1))&63])
# define AttackFile(s,o) (RookL90[s][((o)>>((((s)&7)<<3)+1))&63])
#endif
# define AttackRook(s) (AttackRank(s,occupied)|AttackFile(s,occupied_l90))
# define AttackR45(s,o) (BishopR45[s][((o)>>ShiftR45[s])&63])
# define AttackL45(s,o) (BishopL45[s][((o)>>ShiftL45[s])&63])
# define AttackBishop(s) (AttackR45(s,occupied_r45)|AttackL45(s,occupied_l45))
# define AttackQueen(s) (AttackRook(s)|AttackBishop(s))
and so:
inline BitBoard KnightAttacksFrom(int s) { return (Knight[s]); }
inline BitBoard BishopAttacksFrom(int s) { return (AttackBishop(s)); }
inline BitBoard RookAttacksFrom(int s) { return (AttackRook(s)); }
inline BitBoard QueenAttacksFrom(int s) { return (AttackQueen(s)); }
inline BitBoard KingAttacksFrom(int s) { return (King[s]); }
inline uint IsAttackedBy(uint co,uint sq) {
if (King[sq]&(kings|queens)&Occupied(co)) return 1;
if (Pawn[co^1][sq]&(pawns|bishops)&Occupied(co)) return 1;
if (Knight[sq]&knights&Occupied(co)) return 1;
if (AttackRook(sq)&(rooks|queens)&Occupied(co)) return 1;
if (AttackBishop(sq)&(bishops|queens)&Occupied(co)) return 1;
return 0;
}
inline uint InCheck() {
return IsAttackedBy(stm^1,ksq[stm]);
}
I need to know more about Attack..[] array.
I think I know what the should do but I don't know how they work.
Thank you for your time and help.
Maurizio Di Vitto
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.