template<typename T, int LE> T number(void* addr)
{
- static const union { uint32_t i; char c[4]; } Le = { 0x01020304 };
- static const bool IsLittleEndian = (Le.c[0] == 4);
-
T v;
if ((uintptr_t)addr & (alignof(T) - 1)) // Unaligned pointer (very rare)
std::stringstream ss(Paths);
std::string path;
- while (std::getline(ss, path, SepChar)) {
+ while (std::getline(ss, path, SepChar))
+ {
fname = path + "/" + f;
std::ifstream::open(fname);
if (is_open())
int buf64Size = 64;
Sym sym;
- while (true) {
+ while (true)
+ {
int len = 0; // This is the symbol length - d->min_sym_len
// Now get the symbol length. For any symbol s64 of length l right-padded
// We binary-search for our value recursively expanding into the left and
// right child symbols until we reach a leaf node where symlen[sym] + 1 == 1
// that will store the value we need.
- while (d->symlen[sym]) {
-
+ while (d->symlen[sym])
+ {
Sym left = d->btree[sym].get<LR::Left>();
// If a symbol contains 36 sub-symbols (d->symlen[sym] + 1 = 36) and
WDLScore wdl = -probe_wdl(pos, &result);
dtz = dtz_before_zeroing(wdl);
}
+ else if (pos.is_draw(1))
+ {
+ // In case a root move leads to a draw by repetition or
+ // 50-move rule, we set dtz to zero. Note: since we are
+ // only 1 ply from the root, this must be a true 3-fold
+ // repetition inside the game history.
+ dtz = 0;
+ }
else
{
// Otherwise, take dtz for the new position and correct by 1 ply
ProbeState result;
StateInfo st;
+ WDLScore wdl;
bool rule50 = Options["Syzygy50MoveRule"];
{
pos.do_move(m.pv[0], st);
- WDLScore wdl = -probe_wdl(pos, &result);
+ if (pos.is_draw(1))
+ wdl = WDLDraw;
+ else
+ wdl = -probe_wdl(pos, &result);
pos.undo_move(m.pv[0]);