From: Marco Costalba Date: Thu, 6 May 2010 08:36:01 +0000 (+0200) Subject: Rename king "safety" to king "danger" X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=921bd87280e0164270ddd5c28213d5b4593ca6c3 Rename king "safety" to king "danger" A bigger "safety" value is actually a bigger threat for the king, so it is a bigger "danger" With this renaming "Cowardice" and "Aggressiveness" UCI parameters become easier to understand. It is also easier to understand why the once "safety" value (that is a "danger") is subtracted from evaluation instead of being added. No functional change. --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 4575958c..dbca3328 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -46,7 +46,7 @@ namespace { const int GrainSize = 8; // Evaluation weights, initialized from UCI options - enum { Mobility, PawnStructure, PassedPawns, Space, KingSafetyUs, KingSafetyThem }; + enum { Mobility, PawnStructure, PassedPawns, Space, KingDangerUs, KingDangerThem }; Score Weights[6]; typedef Value V; @@ -203,10 +203,10 @@ namespace { (1ULL<(undefended)) + InitKingDanger[relative_square(Us, s)] @@ -855,14 +855,14 @@ namespace { // out of bounds errors. attackUnits = Min(99, Max(0, attackUnits)); - // Finally, extract the king safety score from the SafetyTable[] array. + // Finally, extract the king danger score from the KingDangerTable[] array. // Subtract the score from evaluation, and set ei.futilityMargin[]. - // The reason for storing the king safety score to futility margin - // is that the king safety scores can sometimes be very big, and that + // The reason for storing the king danger score to futility margin + // is that the king danger scores can sometimes be very big, and that // capturing a single attacking piece can therefore result in a score // change far bigger than the value of the captured piece. - ei.value -= Sign[Us] * SafetyTable[Us][attackUnits]; - ei.futilityMargin[Us] = mg_value(SafetyTable[Us][attackUnits]); + ei.value -= Sign[Us] * KingDangerTable[Us][attackUnits]; + ei.futilityMargin[Us] = mg_value(KingDangerTable[Us][attackUnits]); } } @@ -1223,9 +1223,9 @@ namespace { t[i] = Value(peak); } - // Then apply the weights and get the final SafetyTable[] array + // Then apply the weights and get the final KingDangerTable[] array for (Color c = WHITE; c <= BLACK; c++) for (int i = 0; i < 100; i++) - SafetyTable[c][i] = apply_weight(make_score(t[i], 0), Weights[KingSafetyUs + c]); + KingDangerTable[c][i] = apply_weight(make_score(t[i], 0), Weights[KingDangerUs + c]); } }