mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 02:27:00 +08:00
Use std::abs over abs
closes https://github.com/official-stockfish/Stockfish/pull/4926 closes https://github.com/official-stockfish/Stockfish/pull/4909 No functional change Co-Authored-By: fffelix-huang <72808219+fffelix-huang@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
@@ -164,9 +165,9 @@ Value Eval::evaluate(const Position& pos) {
|
||||
int shuffling = pos.rule50_count();
|
||||
int simpleEval = simple_eval(pos, stm) + (int(pos.key() & 7) - 3);
|
||||
|
||||
bool lazy = abs(simpleEval) >= RookValue + KnightValue + 16 * shuffling * shuffling
|
||||
+ abs(pos.this_thread()->bestValue)
|
||||
+ abs(pos.this_thread()->rootSimpleEval);
|
||||
bool lazy = std::abs(simpleEval) >= RookValue + KnightValue + 16 * shuffling * shuffling
|
||||
+ std::abs(pos.this_thread()->bestValue)
|
||||
+ std::abs(pos.this_thread()->rootSimpleEval);
|
||||
|
||||
if (lazy)
|
||||
v = Value(simpleEval);
|
||||
@@ -178,8 +179,8 @@ Value Eval::evaluate(const Position& pos) {
|
||||
Value optimism = pos.this_thread()->optimism[stm];
|
||||
|
||||
// Blend optimism and eval with nnue complexity and material imbalance
|
||||
optimism += optimism * (nnueComplexity + abs(simpleEval - nnue)) / 512;
|
||||
nnue -= nnue * (nnueComplexity + abs(simpleEval - nnue)) / 32768;
|
||||
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / 512;
|
||||
nnue -= nnue * (nnueComplexity + std::abs(simpleEval - nnue)) / 32768;
|
||||
|
||||
int npm = pos.non_pawn_material() / 64;
|
||||
v = (nnue * (915 + npm + 9 * pos.count<PAWN>()) + optimism * (154 + npm)) / 1024;
|
||||
|
||||
Reference in New Issue
Block a user