refactor in evaluate
This commit is contained in:
1 parent
1ce08aa0cb
commit
968d0f5377
3 files changed
+8
-2
No files matched your search
@@ -1,5 +1,7 @@
|
|||||||
#include "evaluate.h"
|
#include "evaluate.h"
|
||||||
|
|
||||||
|
namespace HCE {
|
||||||
|
|
||||||
static int GetPhaseWeight(Board &board, int color) {
|
static int GetPhaseWeight(Board &board, int color) {
|
||||||
int phase = 0;
|
int phase = 0;
|
||||||
|
|
||||||
@@ -60,3 +62,4 @@ int Evaluate(Board &board) {
|
|||||||
|
|
||||||
return board.sideToMove ? -score : score;
|
return board.sideToMove ? -score : score;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
|
namespace HCE {
|
||||||
|
|
||||||
constexpr int phaseMax = 24;
|
constexpr int phaseMax = 24;
|
||||||
|
|
||||||
constexpr int phaseValues[4] {
|
constexpr int phaseValues[4] {
|
||||||
@@ -155,3 +157,4 @@ constexpr int scoreSquares[64] {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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) {
|
if (bestScore>= beta) {
|
||||||
return bestScore;
|
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);
|
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)) {
|
if (board.InCheck(board.sideToMove)) {
|
||||||
depth++;
|
depth++;
|
||||||
|
|||||||
Reference in new issue
Block a user