]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Better use STL algorithms in Endgame functions
[stockfish] / src / evaluate.cpp
index 6d95fd58cb6cca53a1c968d7fbdaddf142f1e934..5e278242b742ddd2457d0a7f2312b63e47f5b081 100644 (file)
@@ -288,7 +288,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
   margins[WHITE] = margins[BLACK] = VALUE_ZERO;
 
   // Probe the material hash table
-  ei.mi = Threads[pos.thread()].materialTable.get_material_info(pos);
+  ei.mi = Threads[pos.thread()].materialTable.material_info(pos);
   score += ei.mi->material_value();
 
   // If we have a specialized evaluation function for the current material
@@ -300,7 +300,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
   }
 
   // Probe the pawn hash table
-  ei.pi = Threads[pos.thread()].pawnTable.get_pawn_info(pos);
+  ei.pi = Threads[pos.thread()].pawnTable.pawn_info(pos);
   score += ei.pi->pawns_value();
 
   // Initialize attack and king safety bitboards
@@ -412,7 +412,7 @@ void read_evaluation_uci_options(Color us) {
 
   // If running in analysis mode, make sure we use symmetrical king safety. We do this
   // by replacing both Weights[kingDangerUs] and Weights[kingDangerThem] by their average.
-  if (Options["UCI_AnalyseMode"].value<bool>())
+  if (Options["UCI_AnalyseMode"])
       Weights[kingDangerUs] = Weights[kingDangerThem] = (Weights[kingDangerUs] + Weights[kingDangerThem]) / 2;
 
   init_safety();
@@ -463,7 +463,7 @@ namespace {
     if (bonus && bit_is_set(ei.attackedBy[Us][PAWN], s))
     {
         if (   !pos.pieces(KNIGHT, Them)
-            && !(SquaresByColorBB[color_of(s)] & pos.pieces(BISHOP, Them)))
+            && !(same_color_squares(s) & pos.pieces(BISHOP, Them)))
             bonus += bonus + bonus / 2;
         else
             bonus += bonus / 2;
@@ -1101,8 +1101,8 @@ namespace {
   Score weight_option(const std::string& mgOpt, const std::string& egOpt, Score internalWeight) {
 
     // Scale option value from 100 to 256
-    int mg = Options[mgOpt].value<int>() * 256 / 100;
-    int eg = Options[egOpt].value<int>() * 256 / 100;
+    int mg = Options[mgOpt] * 256 / 100;
+    int eg = Options[egOpt] * 256 / 100;
 
     return apply_weight(make_score(mg, eg), internalWeight);
   }