1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Small simplification in space eval scoring

No functional change.
This commit is contained in:
Marco Costalba 2013-07-19 11:00:31 +02:00
parent 99e547f4cb
commit ee5514b8fd
3 changed files with 6 additions and 6 deletions

View file

@ -372,7 +372,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
if (ei.mi->space_weight()) if (ei.mi->space_weight())
{ {
int s = evaluate_space<WHITE>(pos, ei) - evaluate_space<BLACK>(pos, ei); 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 // 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(IMBALANCE, ei.mi->material_value());
Tracing::add(PAWN, ei.pi->pawns_value()); Tracing::add(PAWN, ei.pi->pawns_value());
Tracing::add(UNSTOPPABLE, evaluate_unstoppable_pawns(pos, ei)); Tracing::add(UNSTOPPABLE, evaluate_unstoppable_pawns(pos, ei));
Score w = make_score(ei.mi->space_weight() * evaluate_space<WHITE>(pos, ei), 0); Score w = ei.mi->space_weight() * evaluate_space<WHITE>(pos, ei);
Score b = make_score(ei.mi->space_weight() * evaluate_space<BLACK>(pos, ei), 0); 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(SPACE, apply_weight(w, Weights[Space]), apply_weight(b, Weights[Space]));
Tracing::add(TOTAL, score); Tracing::add(TOTAL, score);
Tracing::stream << "\nUncertainty margin: White: " << to_cp(margins[WHITE]) Tracing::stream << "\nUncertainty margin: White: " << to_cp(margins[WHITE])

View file

@ -259,7 +259,7 @@ Entry* probe(const Position& pos, Table& entries, Endgames& endgames) {
int minorPieceCount = pos.count<KNIGHT>(WHITE) + pos.count<BISHOP>(WHITE) int minorPieceCount = pos.count<KNIGHT>(WHITE) + pos.count<BISHOP>(WHITE)
+ pos.count<KNIGHT>(BLACK) + pos.count<BISHOP>(BLACK); + 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 // Evaluate the material imbalance. We use PIECE_TYPE_NONE as a place holder

View file

@ -39,7 +39,7 @@ namespace Material {
struct Entry { struct Entry {
Score material_value() const { return make_score(value, value); } 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; } Phase game_phase() const { return gamePhase; }
bool specialized_eval_exists() const { return evaluationFunction != NULL; } bool specialized_eval_exists() const { return evaluationFunction != NULL; }
Value evaluate(const Position& p) const { return (*evaluationFunction)(p); } Value evaluate(const Position& p) const { return (*evaluationFunction)(p); }
@ -50,7 +50,7 @@ struct Entry {
uint8_t factor[COLOR_NB]; uint8_t factor[COLOR_NB];
EndgameBase<Value>* evaluationFunction; EndgameBase<Value>* evaluationFunction;
EndgameBase<ScaleFactor>* scalingFunction[COLOR_NB]; EndgameBase<ScaleFactor>* scalingFunction[COLOR_NB];
int spaceWeight; Score spaceWeight;
Phase gamePhase; Phase gamePhase;
}; };