]> git.sesse.net Git - stockfish/blobdiff - src/tune.cpp
Skip moves-loop pruning in qsearch if we have only pawns
[stockfish] / src / tune.cpp
index 424bdac85dcfef5d0f0fcdfce4e6c196d2b38343..97baeb784e9cc497c22ec6672392a4bbae4675f9 100644 (file)
@@ -1,6 +1,6 @@
 /*
   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
-  Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
+  Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
 
   Stockfish is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "tune.h"
+
 #include <algorithm>
 #include <iostream>
+#include <map>
 #include <sstream>
+#include <string>
 
-#include "types.h"
-#include "misc.h"
 #include "uci.h"
 
+namespace Stockfish {
+enum Value : int;
+}
+
 using std::string;
 
+namespace Stockfish {
+
 bool Tune::update_on_last;
 const UCI::Option* LastOption = nullptr;
-BoolConditions Conditions;
 static std::map<std::string, int> TuneResults;
 
 string Tune::next(string& names, bool pop) {
@@ -91,40 +98,11 @@ template<> void Tune::Entry<Value>::read_option() {
       value = Value(int(Options[name]));
 }
 
-template<> void Tune::Entry<Score>::init_option() {
-  make_option("m" + name, mg_value(value), range);
-  make_option("e" + name, eg_value(value), range);
-}
-
-template<> void Tune::Entry<Score>::read_option() {
-  if (Options.count("m" + name))
-      value = make_score(int(Options["m" + name]), eg_value(value));
-
-  if (Options.count("e" + name))
-      value = make_score(mg_value(value), int(Options["e" + name]));
-}
-
 // Instead of a variable here we have a PostUpdate function: just call it
 template<> void Tune::Entry<Tune::PostUpdate>::init_option() {}
 template<> void Tune::Entry<Tune::PostUpdate>::read_option() { value(); }
 
-
-// Set binary conditions according to a probability that depends
-// on the corresponding parameter value.
-
-void BoolConditions::set() {
-
-  static PRNG rng(now());
-  static bool startup = true; // To workaround fishtest bench
-
-  for (size_t i = 0; i < binary.size(); i++)
-      binary[i] = !startup && (values[i] + int(rng.rand<unsigned>() % variance) > threshold);
-
-  startup = false;
-
-  for (size_t i = 0; i < binary.size(); i++)
-      sync_cout << binary[i] << sync_endl;
-}
+} // namespace Stockfish
 
 
 // Init options with tuning session results instead of default values. Useful to
@@ -136,9 +114,12 @@ void BoolConditions::set() {
 //
 // Then paste the output below, as the function body
 
-#include <cmath>
+
+namespace Stockfish {
 
 void Tune::read_results() {
 
   /* ...insert your values here... */
 }
+
+} // namespace Stockfish