@@ -61,11 +61,6 @@ const OptionId kStrictUciTiming{"strict-uci-timing", "StrictTiming",
6161 " The UCI host compensates for lag, waits for "
6262 " the 'readyok' reply before sending 'go' and "
6363 " only then starts timing." };
64- const OptionId kValueOnly {
65- " value-only" , " ValueOnly" ,
66- " In value only mode all search parameters are ignored and the position is "
67- " evaluated by getting the valuation of every child position and choosing "
68- " the worst for the opponent." };
6964const OptionId kClearTree {" " , " ClearTree" ,
7065 " Clear the tree before the next search." };
7166
@@ -123,7 +118,6 @@ void EngineClassic::PopulateOptions(OptionsParser* options) {
123118 options->Add <BoolOption>(kStrictUciTiming ) = false ;
124119 options->HideOption (kStrictUciTiming );
125120
126- options->Add <BoolOption>(kValueOnly ) = false ;
127121 options->Add <ButtonOption>(kClearTree );
128122 options->HideOption (kClearTree );
129123}
@@ -265,74 +259,6 @@ class PonderResponseTransformer : public TransformingUciResponder {
265259 std::string ponder_move_;
266260};
267261
268- void ValueOnlyGo (classic::NodeTree* tree, Network* network,
269- const OptionsDict& options,
270- std::unique_ptr<UciResponder> responder) {
271- auto input_format = network->GetCapabilities ().input_format ;
272-
273- const auto & board = tree->GetPositionHistory ().Last ().GetBoard ();
274- auto legal_moves = board.GenerateLegalMoves ();
275- tree->GetCurrentHead ()->CreateEdges (legal_moves);
276- PositionHistory history = tree->GetPositionHistory ();
277- std::vector<InputPlanes> planes;
278- for (auto edge : tree->GetCurrentHead ()->Edges ()) {
279- history.Append (edge.GetMove ());
280- if (history.ComputeGameResult () == GameResult::UNDECIDED) {
281- planes.emplace_back (EncodePositionForNN (
282- input_format, history, 8 , FillEmptyHistory::FEN_ONLY, nullptr ));
283- }
284- history.Pop ();
285- }
286-
287- std::vector<float > comp_q;
288- int batch_size = options.Get <int >(classic::SearchParams::kMiniBatchSizeId );
289- if (batch_size == 0 ) batch_size = network->GetMiniBatchSize ();
290-
291- for (size_t i = 0 ; i < planes.size (); i += batch_size) {
292- auto comp = network->NewComputation ();
293- for (int j = 0 ; j < batch_size; j++) {
294- comp->AddInput (std::move (planes[i + j]));
295- if (i + j + 1 == planes.size ()) break ;
296- }
297- comp->ComputeBlocking ();
298-
299- for (int j = 0 ; j < batch_size; j++) comp_q.push_back (comp->GetQVal (j));
300- }
301-
302- Move best;
303- int comp_idx = 0 ;
304- float max_q = std::numeric_limits<float >::lowest ();
305- for (auto edge : tree->GetCurrentHead ()->Edges ()) {
306- history.Append (edge.GetMove ());
307- auto result = history.ComputeGameResult ();
308- float q = -1 ;
309- if (result == GameResult::UNDECIDED) {
310- // NN eval is for side to move perspective - so if its good, its bad for
311- // us.
312- q = -comp_q[comp_idx];
313- comp_idx++;
314- } else if (result == GameResult::DRAW) {
315- q = 0 ;
316- } else {
317- // A legal move to a non-drawn terminal without tablebases must be a
318- // win.
319- q = 1 ;
320- }
321- if (q >= max_q) {
322- max_q = q;
323- best = edge.GetMove (tree->GetPositionHistory ().IsBlackToMove ());
324- }
325- history.Pop ();
326- }
327- std::vector<ThinkingInfo> infos;
328- ThinkingInfo thinking;
329- thinking.depth = 1 ;
330- infos.push_back (thinking);
331- responder->OutputThinkingInfo (&infos);
332- BestMoveInfo info (best);
333- responder->OutputBestMove (&info);
334- }
335-
336262} // namespace
337263
338264void EngineClassic::Go (const GoParams& params) {
@@ -374,10 +300,6 @@ void EngineClassic::Go(const GoParams& params) {
374300 // Strip movesleft information from the response.
375301 responder = std::make_unique<MovesLeftResponseFilter>(std::move (responder));
376302 }
377- if (options_.Get <bool >(kValueOnly )) {
378- ValueOnlyGo (tree_.get (), network_.get (), options_, std::move (responder));
379- return ;
380- }
381303
382304 if (options_.Get <Button>(kClearTree ).TestAndReset ()) {
383305 tree_->TrimTreeAtHead ();
0 commit comments