diff options
| author | Adam <adammegarules1@gmail.com> | 2026-07-28 12:50:36 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-07-28 12:50:36 +0200 |
| commit | 50be320c33bd942b238e8f82aa34230539878bab (patch) | |
| tree | d4b98a6a90e49cd29cfdbb8fbf0512e64d907217 /src/bot.cpp | |
| parent | 3109a2516e75072835f1998a9b702003781612d5 (diff) | |
changes
Diffstat (limited to 'src/bot.cpp')
| -rw-r--r-- | src/bot.cpp | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/src/bot.cpp b/src/bot.cpp index e976d11..c8842bd 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -6,21 +6,58 @@ #include <cmath> int PAWN_VALUE = 100; -int KNIGHT_VALUE = 200; -int BISHOP_VALUE = 300; -int ROOK_VALUE = 400; +int KNIGHT_VALUE = 320; +int BISHOP_VALUE = 330; +int ROOK_VALUE = 500; int QUEEN_VALUE = 900; -int CHECK = 20; +int CHECK = 10; int MATE = 10000; -int KNIGHT_TABLE[64] = {-50, -40, -30, -30, -30, -30, -40, -50, -40, -20, 0, - 0, 0, 0, -20, -40, -30, 0, 10, 15, 15, 10, - 0, -30, -30, 5, 15, 20, 20, 15, 5, -30, -30, - 0, 15, 20, 20, 15, 0, -30, -30, 5, 10, 15, - 15, 10, 5, -30, -40, -20, 0, 5, 5, 0, -20, - -40, -50, -40, -30, -30, -30, -30, -40, -50}; - -const int SEARCH_DEPTH = 3; +const int PAWN_TABLE[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, // last rank promotes to a quuen + 50, 50, 50, 50, 50, 50, 50, 50, // comments to stop formating to ruin it + 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, 0, 0, -10, -5, 5, // + 5, 10, 10, -20, -20, 10, 10, 5, // + 0, 0, 0, 0, 0, 0, 0, 0 // +}; + +int KNIGHT_TABLE[64] = { + -50, -40, -30, -30, -30, -30, -40, -50, // + -40, -20, 0, 0, 0, 0, -20, -40, // + -30, 0, 10, 15, 15, 10, 0, -30, // + -30, 5, 15, 20, 20, 15, 5, -30, // + -30, 0, 15, 20, 20, 15, 0, -30, // + -30, 5, 10, 15, 15, 10, 5, -30, // + -40, -20, 0, 5, 5, 0, -20, -40, // + -50, -40, -30, -30, -30, -30, -40, -50, // +}; + +int BISHOP_TABLE[64] = { + -20, -10, -10, -10, -10, -10, -10, -20, // + -10, 5, 0, 0, 0, 0, 5, -10, // + -10, 10, 10, 10, 10, 10, 10, -10, // + -10, 0, 10, 15, 15, 10, 0, -10, // + -10, 5, 5, 10, 10, 5, 5, -10, // + -10, 0, 5, 10, 10, 5, 0, -10, // + -10, 0, 0, 0, 0, 0, 0, -10, // + -20, -10, -10, -10, -10, -10, -10, -20, // +}; + +int ROOK_TABLE[64] = { + 0, 0, 5, 10, 10, 5, 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, 0, 0, 0, 0, -5, // + 5, 10, 10, 10, 10, 10, 10, 5, // + 0, 0, 5, 10, 10, 5, 0, 0, // +}; + +const int SEARCH_DEPTH = 5; #include <fstream> @@ -139,6 +176,7 @@ float EvaluateBoardForWhite(Game *b) { switch (piece.type) { case PAWN: value = PAWN_VALUE; + value += PAWN_TABLE[PSTIndex(i, piece.color)]; break; case KNIGHT: value = KNIGHT_VALUE; @@ -146,9 +184,11 @@ float EvaluateBoardForWhite(Game *b) { break; case BISHOP: value = BISHOP_VALUE; + value += BISHOP_TABLE[PSTIndex(i, piece.color)]; break; case ROOK: value = ROOK_VALUE; + value += ROOK_TABLE[PSTIndex(i, piece.color)]; break; case QUEEN: value = QUEEN_VALUE; |
