aboutsummaryrefslogtreecommitdiff
path: root/src/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/board.c')
-rw-r--r--src/board.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/board.c b/src/board.c
index a0b1bb7..0c133a8 100644
--- a/src/board.c
+++ b/src/board.c
@@ -37,9 +37,18 @@ void precompute_king_attack_table(Bitboard attacks[64]) {
U64 position = BIT << index;
attacks[index] =
- (position & notAFile) << 7 | (position << 8) | (position & notHFile) << 9 |
- (position & notAFile) >> 1 | (position & notHFile) << 1 |
- (position & notAFile) >> 9 | (position >> 8) | (position & notHFile) >> 7;
+ (position & notAFile) << 7 | (position << 8) | (position & notHFile) << 9 |
+ (position & notAFile) >> 1 | (position & notHFile) << 1 |
+ (position & notAFile) >> 9 | (position >> 8) | (position & notHFile) >> 7;
+ }
+}
+
+void precompute_pawn_attack_table(Bitboard attacks[64], BYTE color) {
+ for (int index = 0; index < 64; index++) {
+ U64 position = BIT << index;
+
+ if (color == WHITE) attacks[index] = (position & notAFile) << 7 | (position & notHFile) << 9;
+ else attacks[index] = (position & notAFile) >> 9 | (position & notHFile) >> 7;
}
}