1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00
BadFish/src/bitboard.cpp
2015-01-10 14:26:06 +00:00

20 lines
431 B
C++

#include "bitboard.h"
Bitboard A[8];
Bitboard B[8];
Bitboard C;
/// Bitboards::init() initializes various bitboard tables. It is called at
/// startup and relies on global objects to be already zero-initialized.
void Bitboards::init() {
for (int f = 0; f <= 7; ++f)
A[f] = f > 0 ? A[f - 1] << 1 : 0x01010101;
for (int f = 0; f <= 7; ++f)
B[f] = (f > 0 ? A[f - 1] : 0) | (f < 7 ? A[f + 1] : 0);
C = B[7];
}