1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Introduce namespace Bitbases

Let's continue this namespace galore...

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2012-08-18 13:04:43 +01:00
parent 2c1ba2ab0d
commit 7c1f8dbde9
4 changed files with 15 additions and 11 deletions

View file

@ -62,14 +62,14 @@ namespace {
} }
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); int idx = index(wksq, bksq, wpsq, stm);
return KPKBitbase[idx / 32] & (1 << (idx & 31)); return KPKBitbase[idx / 32] & (1 << (idx & 31));
} }
void kpk_bitbase_init() { void Bitbases::init_kpk() {
Result db[IndexMax]; Result db[IndexMax];
KPKPosition pos; KPKPosition pos;

View file

@ -25,8 +25,15 @@
namespace Bitboards { namespace Bitboards {
extern void init(); void init();
extern void print(Bitboard b); void print(Bitboard b);
}
namespace Bitbases {
void init_kpk();
uint32_t probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm);
} }

View file

@ -20,14 +20,13 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include "bitboard.h"
#include "bitcount.h" #include "bitcount.h"
#include "endgame.h" #include "endgame.h"
#include "movegen.h" #include "movegen.h"
using std::string; using std::string;
extern uint32_t probe_kpk_bitbase(Square wksq, Square wpsq, Square bksq, Color stm);
namespace { namespace {
// Table used to drive the defending king towards the edge of the board // Table used to drive the defending king towards the edge of the board
@ -223,7 +222,7 @@ Value Endgame<KPK>::operator()(const Position& pos) const {
wpsq = mirror(wpsq); wpsq = mirror(wpsq);
} }
if (!probe_kpk_bitbase(wksq, wpsq, bksq, stm)) if (!Bitbases::probe_kpk(wksq, wpsq, bksq, stm))
return VALUE_DRAW; return VALUE_DRAW;
Value result = VALUE_KNOWN_WIN Value result = VALUE_KNOWN_WIN
@ -893,5 +892,5 @@ ScaleFactor Endgame<KPKP>::operator()(const Position& pos) const {
// Probe the KPK bitbase with the weakest side's pawn removed. If it's a draw, // 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. // 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;
} }

View file

@ -28,8 +28,6 @@
#include "tt.h" #include "tt.h"
#include "ucioption.h" #include "ucioption.h"
void kpk_bitbase_init();
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
std::cout << engine_info() << std::endl; std::cout << engine_info() << std::endl;
@ -37,7 +35,7 @@ int main(int argc, char* argv[]) {
UCI::init(Options); UCI::init(Options);
Bitboards::init(); Bitboards::init();
Position::init(); Position::init();
kpk_bitbase_init(); Bitbases::init_kpk();
Search::init(); Search::init();
Threads.init(); Threads.init();
Eval::init(); Eval::init();