From 50be320c33bd942b238e8f82aa34230539878bab Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 28 Jul 2026 12:50:36 +0200 Subject: changes --- src/bot.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 12 deletions(-) (limited to 'src/bot.cpp') 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 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 @@ -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; -- cgit v1.2.3