#include "evaluate.h"
#include "movegen.h"
#include "movepick.h"
-#include "notation.h"
#include "rkiss.h"
#include "search.h"
#include "timeman.h"
#include "thread.h"
#include "tt.h"
-#include "ucioption.h"
+#include "uci.h"
namespace Search {
// Init futility move count array
for (d = 0; d < 32; ++d)
{
- FutilityMoveCounts[0][d] = int(2.4 + 0.222 * pow(d * 2 + 0.00, 1.8));
- FutilityMoveCounts[1][d] = int(3.0 + 0.300 * pow(d * 2 + 0.98, 1.8));
+ FutilityMoveCounts[0][d] = int(2.4 + 0.773 * pow(d + 0.00, 1.8));
+ FutilityMoveCounts[1][d] = int(2.9 + 1.045 * pow(d + 0.49, 1.8));
}
}
pos.undo_move(*it);
}
if (Root)
- sync_cout << move_to_uci(*it, pos.is_chess960()) << ": " << cnt << sync_endl;
+ sync_cout << UCI::format_move(*it, pos.is_chess960()) << ": " << cnt << sync_endl;
}
return nodes;
}
{
RootMoves.push_back(MOVE_NONE);
sync_cout << "info depth 0 score "
- << score_to_uci(RootPos.checkers() ? -VALUE_MATE : VALUE_DRAW)
+ << UCI::format_value(RootPos.checkers() ? -VALUE_MATE : VALUE_DRAW)
<< sync_endl;
goto finalize;
}
// Best move could be MOVE_NONE when searching on a stalemate position
- sync_cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], RootPos.is_chess960())
- << " ponder " << move_to_uci(RootMoves[0].pv[1], RootPos.is_chess960())
+ sync_cout << "bestmove " << UCI::format_move(RootMoves[0].pv[0], RootPos.is_chess960())
+ << " ponder " << UCI::format_move(RootMoves[0].pv[1], RootPos.is_chess960())
<< sync_endl;
}
// Sort the PV lines searched so far and update the GUI
std::stable_sort(RootMoves.begin(), RootMoves.begin() + PVIdx + 1);
- if (PVIdx + 1 == std::min(multiPV, RootMoves.size()) || Time::now() - SearchTime > 3000)
+ if ( !Signals.stop
+ && ( PVIdx + 1 == std::min(multiPV, RootMoves.size())
+ || Time::now() - SearchTime > 3000))
sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl;
}
if (thisThread == Threads.main() && Time::now() - SearchTime > 3000)
sync_cout << "info depth " << depth
- << " currmove " << move_to_uci(move, pos.is_chess960())
+ << " currmove " << UCI::format_move(move, pos.is_chess960())
<< " currmovenumber " << moveCount + PVIdx << sync_endl;
}
}
}
+ // Speculative prefetch as early as possible
+ prefetch((char*)TT.first_entry(pos.key_after(move)));
+
// Check for legality just before making the move
if (!RootNode && !SpNode && !pos.legal(move, ci.pinned))
{
&& pos.see_sign(move) < VALUE_ZERO)
continue;
+ // Speculative prefetch as early as possible
+ prefetch((char*)TT.first_entry(pos.key_after(move)));
+
// Check for legality just before making the move
if (!pos.legal(move, ci.pinned))
continue;
ss << "info depth " << d
<< " seldepth " << selDepth
- << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
+ << " multipv " << i + 1
+ << " score " << (i == PVIdx ? UCI::format_value(v, alpha, beta) : UCI::format_value(v))
<< " nodes " << pos.nodes_searched()
<< " nps " << pos.nodes_searched() * 1000 / elapsed
<< " time " << elapsed
- << " multipv " << i + 1
<< " pv";
for (size_t j = 0; RootMoves[i].pv[j] != MOVE_NONE; ++j)
- ss << " " << move_to_uci(RootMoves[i].pv[j], pos.is_chess960());
+ ss << " " << UCI::format_move(RootMoves[i].pv[j], pos.is_chess960());
}
return ss.str();