Small simplification in space eval scoring
authorMarco Costalba <mcostalba@gmail.com>
Fri, 19 Jul 2013 09:00:31 +0000 (11:00 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 19 Jul 2013 09:13:18 +0000 (11:13 +0200)
No functional change.

src/evaluate.cpp
src/material.cpp
src/material.h

index 207892f4dea1fce081a588dcbab770b8c3aab18e..b63615a95ce439094835e8631128b699953e5188 100644 (file)
@@ -372,7 +372,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
   if (ei.mi->space_weight())
   {
       int s = evaluate_space<WHITE>(pos, ei) - evaluate_space<BLACK>(pos, ei);
-      score += apply_weight(make_score(s * ei.mi->space_weight(), 0), Weights[Space]);
+      score += apply_weight(s * ei.mi->space_weight(), Weights[Space]);
   }
 
   // Scale winning side if position is more drawish that what it appears
@@ -410,8 +410,8 @@ Value do_evaluate(const Position& pos, Value& margin) {
       Tracing::add(IMBALANCE, ei.mi->material_value());
       Tracing::add(PAWN, ei.pi->pawns_value());
       Tracing::add(UNSTOPPABLE, evaluate_unstoppable_pawns(pos, ei));
-      Score w = make_score(ei.mi->space_weight() * evaluate_space<WHITE>(pos, ei), 0);
-      Score b = make_score(ei.mi->space_weight() * evaluate_space<BLACK>(pos, ei), 0);
+      Score w = ei.mi->space_weight() * evaluate_space<WHITE>(pos, ei);
+      Score b = ei.mi->space_weight() * evaluate_space<BLACK>(pos, ei);
       Tracing::add(SPACE, apply_weight(w, Weights[Space]), apply_weight(b, Weights[Space]));
       Tracing::add(TOTAL, score);
       Tracing::stream << "\nUncertainty margin: White: " << to_cp(margins[WHITE])
index 22953cff6d8d4328706cb1ffe4299d46214d2c05..abad2abb923e053291bb22e41d21585b8573e47d 100644 (file)
@@ -259,7 +259,7 @@ Entry* probe(const Position& pos, Table& entries, Endgames& endgames) {
       int minorPieceCount =  pos.count<KNIGHT>(WHITE) + pos.count<BISHOP>(WHITE)
                            + pos.count<KNIGHT>(BLACK) + pos.count<BISHOP>(BLACK);
 
-      e->spaceWeight = minorPieceCount * minorPieceCount;
+      e->spaceWeight = make_score(minorPieceCount * minorPieceCount, 0);
   }
 
   // Evaluate the material imbalance. We use PIECE_TYPE_NONE as a place holder
index 751edec90889de2f295751855268db15105702ac..96fd3f8fe994124b30d28d08486c1b391f456164 100644 (file)
@@ -39,7 +39,7 @@ namespace Material {
 struct Entry {
 
   Score material_value() const { return make_score(value, value); }
-  int space_weight() const { return spaceWeight; }
+  Score space_weight() const { return spaceWeight; }
   Phase game_phase() const { return gamePhase; }
   bool specialized_eval_exists() const { return evaluationFunction != NULL; }
   Value evaluate(const Position& p) const { return (*evaluationFunction)(p); }
@@ -50,7 +50,7 @@ struct Entry {
   uint8_t factor[COLOR_NB];
   EndgameBase<Value>* evaluationFunction;
   EndgameBase<ScaleFactor>* scalingFunction[COLOR_NB];
-  int spaceWeight;
+  Score spaceWeight;
   Phase gamePhase;
 };