implemented tapered eval

This commit is contained in:
rektdie committed 2025-03-06 07:58:57 +01:00
1 parent a9137e135e
commit 1de3779add
2 files changed
+96 -16

No files matched your search

+73 -12
View File
@@ -1,6 +1,15 @@
#pragma once
#include "board.h"
constexpr int phaseMax = 24;
constexpr int phaseValues[4] {
1, // Knight
1, // Bishop
2, // Rook
4 // Queen
};
constexpr int materialValues[6] {
100, // Pawn
300, // Knight
@@ -10,7 +19,7 @@ constexpr int materialValues[6] {
10000 // King
};
constexpr int pieceSquareScores[7][64] {
constexpr int middlePieceScores[6][64] {
// Pawn
{0, 0, 0, 0, 0, 0, 0, 0,
50, 50, 50, 50, 50, 50, 50, 50,
@@ -61,7 +70,7 @@ constexpr int pieceSquareScores[7][64] {
-10, 0, 5, 0, 0, 0, 0,-10,
-20,-10,-10, -5, -5,-10,-10,-20},
// King middle game
// King
{-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
@@ -70,16 +79,68 @@ constexpr int pieceSquareScores[7][64] {
-10,-20,-20,-20,-20,-20,-20,-10,
20, 20, 0, 0, 0, 0, 20, 20,
20, 30, 10, 0, 0, 10, 30, 20},
// King end game
{-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-20,-30,-30,-40,-40,-30,-30,-20,
-10,-20,-20,-20,-20,-20,-20,-10,
20, 20, 0, 0, 0, 0, 20, 20,
20, 30, 10, 0, 0, 10, 30, 20}
};
constexpr int endPieceSquares[6][64] {
// Pawn
{0, 0, 0, 0, 0, 0, 0, 0,
50, 50, 50, 50, 50, 50, 50, 50,
10, 10, 20, 30, 30, 20, 10, 10,
5, 5, 10, 25, 25, 10, 5, 5,
0, 0, 0, 20, 20, 0, 0, 0,
5, -5,-10, 30, 30,-10, -5, 5,
5, 10, 10,-20,-20, 10, 10, 5,
0, 0, 0, 0, 0, 0, 0, 0},
// Knight
{-50,-40,-30,-30,-30,-30,-40,-50,
-40,-20, 0, 0, 0, 0,-20,-40,
-30, 0, 5, 10, 10, 5, 0,-30,
-30, 5, 10, 15, 15, 10, 5,-30,
-30, 0, 10, 15, 15, 10, 0,-30,
-30, 5, 5, 10, 10, 5, 5,-30,
-40,-20, 0, 5, 5, 0,-20,-40,
-50,-40,-30,-30,-30,-30,-40,-50},
// Bishop
{-20,-10,-10,-10,-10,-10,-10,-20,
-10, 0, 0, 0, 0, 0, 0,-10,
-10, 0, 5, 10, 10, 5, 0,-10,
-10, 5, 5, 15, 15, 5, 5,-10,
-10, 0, 10, 15, 15, 10, 0,-10,
-10, 10, 10, 15, 15, 10, 10,-10,
-10, 5, 0, 5, 5, 0, 5,-10,
-20,-10,-10,-10,-10,-10,-10,-20},
// Rook
{0, 0, 0, 5, 5, 0, 0, 0,
5, 10, 10, 10, 10, 10, 10, 5,
-5, 0, 0, 0, 0, 0, 0, -5,
-5, 0, 0, 5, 5, 0, 0, -5,
-5, 0, 0, 5, 5, 0, 0, -5,
-5, 0, 0, 5, 5, 0, 0, -5,
-5, 0, 0, 5, 5, 0, 0, -5,
0, 0, 5, 10, 10, 5, 0, 0},
// Queen
{-20,-10,-10, -5, -5,-10,-10,-20,
-10, 0, 0, 0, 0, 0, 0,-10,
-10, 0, 5, 5, 5, 5, 0,-10,
-5, 0, 5, 5, 5, 5, 0, -5,
0, 0, 5, 5, 5, 5, 0, -5,
-10, 5, 5, 5, 5, 5, 0,-10,
-10, 0, 5, 0, 0, 0, 0,-10,
-20,-10,-10, -5, -5,-10,-10,-20},
// King
{-50,-40,-30,-20,-20,-30,-40,-50,
-30,-20,-10, 0, 0,-10,-20,-30,
-30,-10, 20, 30, 30, 20,-10,-30,
-30,-10, 30, 40, 40, 30,-10,-30,
-30,-10, 30, 40, 40, 30,-10,-30,
-30,-10, 20, 30, 30, 20,-10,-30,
-30,-20,-10, 0, 0,-10,-20,-30,
-50,-40,-30,-20,-20,-30,-40,-50},
};
constexpr int scoreSquares[64] {