Skip to content

Instantly share code, notes, and snippets.

@nagat01
Created November 15, 2010 02:14
Show Gist options
  • Save nagat01/676333 to your computer and use it in GitHub Desktop.
Save nagat01/676333 to your computer and use it in GitHub Desktop.
#define BishopAttacks(sq,occ)
(MagicAttacks[
BOffset[(sq)] +
(((BMagicMask[(sq)] & (occ)) * BMagic[(sq)]) >> BShift[(sq)])
])
#define RookAttacks(sq,occ)
(MagicAttacks[
ROffset[(sq)] +
(((RMagicMask[(sq)] & (occ)) * RMagic[(sq)]) >> RShift[(sq)])
])
#define QueenAttacks(sq,occ) (BishopAttacks(sq,occ) | RookAttacks(sq,occ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment