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

Reorder evaluation start

In evaluate, we start by initializing the pos.psq_score
and adding the material imbalance. After that, we check
whether a specialized eval exists and if yes we return
that value and discard whatever we have computed until now.

It sounds more logical to first probe material entry and
return if we have a specialized eval, and only if it is
not the case initialize eval with some values. There is
no measurable speed-difference on my computer.

Non functional change.
This commit is contained in:
Stefano Cardanobile 2016-09-10 17:23:26 +02:00 committed by Marco Costalba
parent 602d7fbb07
commit 4c95edddbf

View file

@ -779,23 +779,22 @@ Value Eval::evaluate(const Position& pos) {
assert(!pos.checkers()); assert(!pos.checkers());
Score mobility[COLOR_NB] = { SCORE_ZERO, SCORE_ZERO };
EvalInfo ei; EvalInfo ei;
Score score, mobility[COLOR_NB] = { SCORE_ZERO, SCORE_ZERO };
// Initialize score by reading the incrementally updated scores included in
// the position object (material + piece square tables). Score is computed
// internally from the white point of view.
score = pos.psq_score();
// Probe the material hash table // Probe the material hash table
ei.me = Material::probe(pos); ei.me = Material::probe(pos);
score += ei.me->imbalance();
// If we have a specialized evaluation function for the current material // If we have a specialized evaluation function for the current material
// configuration, call it and return. // configuration, call it and return.
if (ei.me->specialized_eval_exists()) if (ei.me->specialized_eval_exists())
return ei.me->evaluate(pos); return ei.me->evaluate(pos);
// Initialize score by reading the incrementally updated scores included in
// the position object (material + piece square tables) and the material
// imbalance. Score is computed internally from the white point of view.
Score score = pos.psq_score() + ei.me->imbalance();
// Probe the pawn hash table // Probe the pawn hash table
ei.pi = Pawns::probe(pos); ei.pi = Pawns::probe(pos);
score += ei.pi->pawns_score(); score += ei.pi->pawns_score();