// Given a position with 6 or fewer pieces, produce a text string
// of the form KQPvKRP, where "KQP" represents the white pieces if
// Given a position with 6 or fewer pieces, produce a text string
// of the form KQPvKRP, where "KQP" represents the white pieces if
color = !mirror ? WHITE : BLACK;
for (pt = KING; pt >= PAWN; --pt)
for (i = popcount<Max15>(pos.pieces(color, pt)); i > 0; i--)
color = !mirror ? WHITE : BLACK;
for (pt = KING; pt >= PAWN; --pt)
for (i = popcount<Max15>(pos.pieces(color, pt)); i > 0; i--)
//
// A return value false indicates that not all probes were successful and that
// no moves were filtered out.
//
// A return value false indicates that not all probes were successful and that
// no moves were filtered out.
pos.do_move(move, st, ci, pos.gives_check(move, ci));
int v = 0;
if (pos.checkers() && dtz > 0) {
pos.do_move(move, st, ci, pos.gives_check(move, ci));
int v = 0;
if (pos.checkers() && dtz > 0) {
// If the position is winning or losing, but too few moves left, adjust the
// score to show how close it is to winning or losing.
// NOTE: int(PawnValueEg) is used as scaling factor in score_to_uci().
if (wdl == 1 && dtz <= 100)
// If the position is winning or losing, but too few moves left, adjust the
// score to show how close it is to winning or losing.
// NOTE: int(PawnValueEg) is used as scaling factor in score_to_uci().
if (wdl == 1 && dtz <= 100)
// that stay safely within the 50-move budget, if there are any.
if (!has_repeated(st.previous) && best + cnt50 <= 99)
max = 99 - cnt50;
// that stay safely within the 50-move budget, if there are any.
if (!has_repeated(st.previous) && best + cnt50 <= 99)
max = 99 - cnt50;
if (v < best)
best = v;
}
// Try all moves, unless we approach or have a 50-move rule draw.
if (-best * 2 + cnt50 < 100)
return true;
if (v < best)
best = v;
}
// Try all moves, unless we approach or have a 50-move rule draw.
if (-best * 2 + cnt50 < 100)
return true;
- for (size_t i = 0; i < Search::RootMoves.size(); i++) {
- if (Search::RootMoves[i].score == best)
- Search::RootMoves[j++] = Search::RootMoves[i];
+ for (size_t i = 0; i < rootMoves.size(); i++) {
+ if (rootMoves[i].score == best)
+ rootMoves[j++] = rootMoves[i];
- for (size_t i = 0; i < Search::RootMoves.size(); i++) {
- if (Search::RootMoves[i].score == 0)
- Search::RootMoves[j++] = Search::RootMoves[i];
+ for (size_t i = 0; i < rootMoves.size(); i++) {
+ if (rootMoves[i].score == 0)
+ rootMoves[j++] = rootMoves[i];
//
// A return value false indicates that not all probes were successful and that
// no moves were filtered out.
//
// A return value false indicates that not all probes were successful and that
// no moves were filtered out.
{
int success;
int wdl = Tablebases::probe_wdl(pos, &success);
if (!success) return false;
{
int success;
int wdl = Tablebases::probe_wdl(pos, &success);
if (!success) return false;
pos.do_move(move, st, ci, pos.gives_check(move, ci));
int v = -Tablebases::probe_wdl(pos, &success);
pos.undo_move(move);
if (!success) return false;
pos.do_move(move, st, ci, pos.gives_check(move, ci));
int v = -Tablebases::probe_wdl(pos, &success);
pos.undo_move(move);
if (!success) return false;
- for (size_t i = 0; i < Search::RootMoves.size(); i++) {
- if (Search::RootMoves[i].score == best)
- Search::RootMoves[j++] = Search::RootMoves[i];
+ for (size_t i = 0; i < rootMoves.size(); i++) {
+ if (rootMoves[i].score == best)
+ rootMoves[j++] = rootMoves[i];