mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Refactor pure static eval code
This commit tries to make the new pure static eval code more readable by splitting up the nested assignments into separate lines and making a few more cosmetic tweaks. No functional change.
This commit is contained in:
parent
8a4821923a
commit
4aa091cf44
1 changed files with 14 additions and 8 deletions
|
@ -705,15 +705,16 @@ namespace {
|
|||
// Step 6. Static evaluation of the position
|
||||
if (inCheck)
|
||||
{
|
||||
ss->staticEval = pureStaticEval = eval = VALUE_NONE;
|
||||
ss->staticEval = eval = pureStaticEval = VALUE_NONE;
|
||||
improving = false;
|
||||
goto moves_loop; // Skip early pruning when in check
|
||||
}
|
||||
else if (ttHit)
|
||||
{
|
||||
// Never assume anything on values stored in TT
|
||||
if ((ss->staticEval = pureStaticEval = eval = tte->eval()) == VALUE_NONE)
|
||||
eval = ss->staticEval = pureStaticEval = evaluate(pos);
|
||||
ss->staticEval = eval = pureStaticEval = tte->eval();
|
||||
if (eval == VALUE_NONE)
|
||||
ss->staticEval = eval = pureStaticEval = evaluate(pos);
|
||||
|
||||
// Can ttValue be used as a better position evaluation?
|
||||
if ( ttValue != VALUE_NONE
|
||||
|
@ -722,12 +723,17 @@ namespace {
|
|||
}
|
||||
else
|
||||
{
|
||||
int p = (ss-1)->statScore;
|
||||
int bonus = p > 0 ? (-p - 2500) / 512 :
|
||||
p < 0 ? (-p + 2500) / 512 : 0;
|
||||
if ((ss-1)->currentMove != MOVE_NULL)
|
||||
{
|
||||
int p = (ss-1)->statScore;
|
||||
int bonus = p > 0 ? (-p - 2500) / 512 :
|
||||
p < 0 ? (-p + 2500) / 512 : 0;
|
||||
|
||||
ss->staticEval = eval = (ss-1)->currentMove != MOVE_NULL ? (pureStaticEval = evaluate(pos)) + bonus
|
||||
: (pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo);
|
||||
pureStaticEval = evaluate(pos);
|
||||
ss->staticEval = eval = pureStaticEval + bonus;
|
||||
}
|
||||
else
|
||||
ss->staticEval = eval = pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo;
|
||||
|
||||
tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue