]> git.sesse.net Git - stockfish/commitdiff
Re-add 'Cowardice' and 'Aggressiveness' UCI options
authorMarco Costalba <mcostalba@gmail.com>
Sun, 7 Apr 2013 08:25:21 +0000 (10:25 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 9 Apr 2013 21:29:58 +0000 (23:29 +0200)
I have lost my bet with Jean-Paul, so now I re-add
the two options...and I am glad of it :-)

No functional change.

polyglot.ini
src/evaluate.cpp
src/ucioption.cpp

index ce6669c6866e85c687b78a3dc4d71ebb386b17f5..86c8c7cafe9c7bca0313cc8e3ced93a420b7cadc 100644 (file)
@@ -24,6 +24,8 @@ Mobility (Endgame) = 100
 Passed Pawns (Middle Game) = 100
 Passed Pawns (Endgame) = 100
 Space = 100
 Passed Pawns (Middle Game) = 100
 Passed Pawns (Endgame) = 100
 Space = 100
+Aggressiveness = 100
+Cowardice = 100
 Min Split Depth = 4
 Max Threads per Split Point = 5
 Threads = 1
 Min Split Depth = 4
 Max Threads per Split Point = 5
 Threads = 1
index 85fac61e6bac504dd9cc6f5b59939ce88398a5cb..cb5e284644e92bbbc0f548e281c1d0cc2c451fde 100644 (file)
@@ -75,8 +75,8 @@ namespace {
   const int GrainSize = 8;
 
   // Evaluation weights, initialized from UCI options
   const int GrainSize = 8;
 
   // Evaluation weights, initialized from UCI options
-  enum { Mobility, PassedPawns, Space };
-  Score Weights[3];
+  enum { Mobility, PassedPawns, Space, KingDangerUs, KingDangerThem };
+  Score Weights[6];
 
   typedef Value V;
   #define S(mg, eg) make_score(mg, eg)
 
   typedef Value V;
   #define S(mg, eg) make_score(mg, eg)
@@ -88,7 +88,7 @@ namespace {
   //
   // Values modified by Joona Kiiski
   const Score WeightsInternal[] = {
   //
   // Values modified by Joona Kiiski
   const Score WeightsInternal[] = {
-      S(252, 344), S(216, 266), S(46, 0)
+      S(252, 344), S(216, 266), S(46, 0), S(247, 0), S(259, 0)
   };
 
   // MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
   };
 
   // MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
@@ -197,10 +197,6 @@ namespace {
   // the strength of the enemy attack are added up into an integer, which
   // is used as an index to KingDangerTable[].
   //
   // the strength of the enemy attack are added up into an integer, which
   // is used as an index to KingDangerTable[].
   //
-  // King safety evaluation is asymmetrical and different for us (root color)
-  // and for our opponent. These values are used to init KingDangerTable.
-  const int KingDangerWeights[] = { 259, 247 };
-
   // KingAttackWeights[PieceType] contains king attack weights by piece type
   const int KingAttackWeights[] = { 0, 0, 2, 2, 3, 5 };
 
   // KingAttackWeights[PieceType] contains king attack weights by piece type
   const int KingAttackWeights[] = { 0, 0, 2, 2, 3, 5 };
 
@@ -287,16 +283,19 @@ namespace Eval {
 
   void init() {
 
 
   void init() {
 
-    Weights[Mobility]    = weight_option("Mobility (Middle Game)", "Mobility (Endgame)", WeightsInternal[Mobility]);
-    Weights[PassedPawns] = weight_option("Passed Pawns (Middle Game)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
-    Weights[Space]       = weight_option("Space", "Space", WeightsInternal[Space]);
-
-    int KingDanger[] = { KingDangerWeights[0], KingDangerWeights[1] };
-
-    // If running in analysis mode, make sure we use symmetrical king safety.
-    // We do so by replacing both KingDanger weights by their average.
+    Weights[Mobility]       = weight_option("Mobility (Middle Game)", "Mobility (Endgame)", WeightsInternal[Mobility]);
+    Weights[PassedPawns]    = weight_option("Passed Pawns (Middle Game)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
+    Weights[Space]          = weight_option("Space", "Space", WeightsInternal[Space]);
+    Weights[KingDangerUs]   = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
+    Weights[KingDangerThem] = weight_option("Aggressiveness", "Aggressiveness", WeightsInternal[KingDangerThem]);
+
+    // King safety is asymmetrical. Our king danger level is weighted by
+    // "Cowardice" UCI parameter, instead the opponent one by "Aggressiveness".
+    // 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"])
     if (Options["UCI_AnalyseMode"])
-        KingDanger[0] = KingDanger[1] = (KingDanger[0] + KingDanger[1]) / 2;
+        Weights[KingDangerUs] = Weights[KingDangerThem] = (Weights[KingDangerUs] + Weights[KingDangerThem]) / 2;
 
     const int MaxSlope = 30;
     const int Peak = 1280;
 
     const int MaxSlope = 30;
     const int Peak = 1280;
@@ -305,8 +304,8 @@ namespace Eval {
     {
         t = std::min(Peak, std::min(int(0.4 * i * i), t + MaxSlope));
 
     {
         t = std::min(Peak, std::min(int(0.4 * i * i), t + MaxSlope));
 
-        KingDangerTable[0][i] = apply_weight(make_score(t, 0), make_score(KingDanger[0], 0));
-        KingDangerTable[1][i] = apply_weight(make_score(t, 0), make_score(KingDanger[1], 0));
+        KingDangerTable[1][i] = apply_weight(make_score(t, 0), Weights[KingDangerUs]);
+        KingDangerTable[0][i] = apply_weight(make_score(t, 0), Weights[KingDangerThem]);
     }
   }
 
     }
   }
 
index 1a29cae1d879ed5480834fbc8019435d18cdb633..4bb4369fc843b593759ef530e0bbb718a0f1def5 100644 (file)
@@ -70,6 +70,8 @@ void init(OptionsMap& o) {
   o["Passed Pawns (Middle Game)"]  = Option(100, 0, 200, on_eval);
   o["Passed Pawns (Endgame)"]      = Option(100, 0, 200, on_eval);
   o["Space"]                       = Option(100, 0, 200, on_eval);
   o["Passed Pawns (Middle Game)"]  = Option(100, 0, 200, on_eval);
   o["Passed Pawns (Endgame)"]      = Option(100, 0, 200, on_eval);
   o["Space"]                       = Option(100, 0, 200, on_eval);
+  o["Aggressiveness"]              = Option(100, 0, 200, on_eval);
+  o["Cowardice"]                   = Option(100, 0, 200, on_eval);
   o["Min Split Depth"]             = Option(msd, 4, 12, on_threads);
   o["Max Threads per Split Point"] = Option(5, 4, 8, on_threads);
   o["Threads"]                     = Option(cpus, 1, MAX_THREADS, on_threads);
   o["Min Split Depth"]             = Option(msd, 4, 12, on_threads);
   o["Max Threads per Split Point"] = Option(5, 4, 8, on_threads);
   o["Threads"]                     = Option(cpus, 1, MAX_THREADS, on_threads);