From ee5514b8fdc6583d134985edd2f875e197830030 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Fri, 19 Jul 2013 11:00:31 +0200 Subject: [PATCH] Small simplification in space eval scoring No functional change. --- src/evaluate.cpp | 6 +++--- src/material.cpp | 2 +- src/material.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 207892f4..b63615a9 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -372,7 +372,7 @@ Value do_evaluate(const Position& pos, Value& margin) { if (ei.mi->space_weight()) { int s = evaluate_space(pos, ei) - evaluate_space(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(pos, ei), 0); - Score b = make_score(ei.mi->space_weight() * evaluate_space(pos, ei), 0); + Score w = ei.mi->space_weight() * evaluate_space(pos, ei); + Score b = ei.mi->space_weight() * evaluate_space(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]) diff --git a/src/material.cpp b/src/material.cpp index 22953cff..abad2abb 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -259,7 +259,7 @@ Entry* probe(const Position& pos, Table& entries, Endgames& endgames) { int minorPieceCount = pos.count(WHITE) + pos.count(WHITE) + pos.count(BLACK) + pos.count(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 diff --git a/src/material.h b/src/material.h index 751edec9..96fd3f8f 100644 --- a/src/material.h +++ b/src/material.h @@ -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* evaluationFunction; EndgameBase* scalingFunction[COLOR_NB]; - int spaceWeight; + Score spaceWeight; Phase gamePhase; }; -- 2.39.2