}
-uint32_t probe_kpk_bitbase(Square wksq, Square wpsq, Square bksq, Color stm) {
+uint32_t Bitbases::probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm) {
int idx = index(wksq, bksq, wpsq, stm);
return KPKBitbase[idx / 32] & (1 << (idx & 31));
}
-void kpk_bitbase_init() {
+void Bitbases::init_kpk() {
Result db[IndexMax];
KPKPosition pos;
namespace Bitboards {
-extern void init();
-extern void print(Bitboard b);
+void init();
+void print(Bitboard b);
+
+}
+
+namespace Bitbases {
+
+void init_kpk();
+uint32_t probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm);
}
#include <algorithm>
#include <cassert>
+#include "bitboard.h"
#include "bitcount.h"
#include "endgame.h"
#include "movegen.h"
using std::string;
-extern uint32_t probe_kpk_bitbase(Square wksq, Square wpsq, Square bksq, Color stm);
-
namespace {
// Table used to drive the defending king towards the edge of the board
wpsq = mirror(wpsq);
}
- if (!probe_kpk_bitbase(wksq, wpsq, bksq, stm))
+ if (!Bitbases::probe_kpk(wksq, wpsq, bksq, stm))
return VALUE_DRAW;
Value result = VALUE_KNOWN_WIN
// Probe the KPK bitbase with the weakest side's pawn removed. If it's a draw,
// it's probably at least a draw even with the pawn.
- return probe_kpk_bitbase(wksq, wpsq, bksq, stm) ? SCALE_FACTOR_NONE : SCALE_FACTOR_DRAW;
+ return Bitbases::probe_kpk(wksq, wpsq, bksq, stm) ? SCALE_FACTOR_NONE : SCALE_FACTOR_DRAW;
}
#include "tt.h"
#include "ucioption.h"
-void kpk_bitbase_init();
-
int main(int argc, char* argv[]) {
std::cout << engine_info() << std::endl;
UCI::init(Options);
Bitboards::init();
Position::init();
- kpk_bitbase_init();
+ Bitbases::init_kpk();
Search::init();
Threads.init();
Eval::init();