refactor in evaluate
This commit is contained in:
1 parent
1ce08aa0cb
commit
968d0f5377
3 files changed
+9
-3
No files matched your search
@@ -1,5 +1,7 @@
|
||||
#include "evaluate.h"
|
||||
|
||||
namespace HCE {
|
||||
|
||||
static int GetPhaseWeight(Board &board, int color) {
|
||||
int phase = 0;
|
||||
|
||||
@@ -60,3 +62,4 @@ int Evaluate(Board &board) {
|
||||
|
||||
return board.sideToMove ? -score : score;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "board.h"
|
||||
|
||||
namespace HCE {
|
||||
|
||||
constexpr int phaseMax = 24;
|
||||
|
||||
constexpr int phaseValues[4] {
|
||||
@@ -154,4 +156,5 @@ constexpr int scoreSquares[64] {
|
||||
a1, b1, c1, d1, e1, f1, g1, h1
|
||||
};
|
||||
|
||||
int Evaluate(Board &board);
|
||||
int Evaluate(Board &board);
|
||||
}
|
||||
+2
-2
@@ -118,7 +118,7 @@ static SearchResults Quiescence(Board board, int alpha, int beta, int ply) {
|
||||
}
|
||||
}
|
||||
|
||||
int bestScore = Evaluate(board);
|
||||
int bestScore = HCE::Evaluate(board);
|
||||
|
||||
if (bestScore>= beta) {
|
||||
return bestScore;
|
||||
@@ -181,7 +181,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
|
||||
|
||||
if (depth <= 0) return Quiescence(board, alpha, beta, ply);
|
||||
|
||||
const int staticEval = Evaluate(board);
|
||||
const int staticEval = HCE::Evaluate(board);
|
||||
|
||||
if (board.InCheck(board.sideToMove)) {
|
||||
depth++;
|
||||
|
||||
Reference in new issue
Block a user