#include "syzygy/tbprobe.h"
namespace PSQT {
- void init();
+ void init(const Variant* v);
}
int main(int argc, char* argv[]) {
variants.init();
UCI::init(Options);
- PSQT::init();
+ PSQT::init(variants.find("chess")->second);
Bitboards::init();
Position::init();
Bitbases::init();
#include <algorithm>
#include "types.h"
+#include "variant.h"
Value PieceValue[PHASE_NB][PIECE_NB] = {
{ VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg,
// init() initializes piece-square tables: the white halves of the tables are
// copied from Bonus[] adding the piece value, then the black halves of the
// tables are initialized by flipping and changing the sign of the white scores.
-void init() {
+void init(const Variant* v) {
for (PieceType pt = PAWN; pt <= KING; ++pt)
{
for (Square s = SQ_A1; s <= SQ_MAX; ++s)
{
- File f = std::min(file_of(s), ~file_of(s));
+ File f = std::max(std::min(file_of(s), File(v->maxFile - file_of(s))), FILE_A);
psq[ pc][ s] = score + (pt == KING ? KingBonus[std::min(rank_of(s), RANK_8)][std::min(f, FILE_D)] : Bonus[pc][std::min(rank_of(s), RANK_8)][std::min(f, FILE_D)]);
psq[~pc][~s] = -psq[pc][s];
}
UCI::OptionsMap Options; // Global object
+namespace PSQT {
+ void init(const Variant* v);
+}
+
namespace UCI {
/// 'On change' actions, triggered by an option's value change
void on_threads(const Option& o) { Threads.set(o); }
void on_tb_path(const Option& o) { Tablebases::init(o); }
void on_variant_change(const Option &o) {
- const Variant * v = variants.find(o)->second;
+ const Variant* v = variants.find(o)->second;
+ PSQT::init(v);
sync_cout << "info string variant " << (std::string)o
<< " files " << v->maxFile + 1
<< " ranks " << v->maxRank + 1