From ddb282a899fc61a124328cc79511a20cca60f655 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 31 Aug 2022 05:06:40 +0300 Subject: feat: display current score --- src/config.h | 4 ++-- src/main.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/config.h b/src/config.h index 951b9b3..c179aa9 100644 --- a/src/config.h +++ b/src/config.h @@ -1,8 +1,8 @@ #define BOARD_SIZE 8 #define DEFAULT_FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" -#define MAX_DEPTH 4 +#define MAX_DEPTH 5 #define MAX_AVAILABLE_MOVES 64 * 64 #define INFINITY 1000000 -#define PLAYER WHITE #define MAX_ZOBRIST_SEEDS 1500 #define TRANSPOSITION_TABLE_SIZE 1000000 +#define PLAYER WHITE diff --git a/src/main.c b/src/main.c index 81b751f..372c01e 100644 --- a/src/main.c +++ b/src/main.c @@ -445,6 +445,9 @@ int compute_score(int* board, int mobility, int mobility_color) { int white_material_advantage = compute_material_advantage(board, WHITE); + // If pre-computed mobility has not been passed, compute it + if (!mobility) mobility = list_available_moves(NULL, board, mobility_color); + int opponent_mobility = list_available_moves(NULL, board, mobility_color ^ 1); int white_mobility_advantage = (mobility - opponent_mobility) * (mobility_color == WHITE ? 1 : -1); @@ -590,6 +593,7 @@ int main() { apply_move(move, board); print_board(board); + printf("Current score: %i\n", compute_score(board, 0, WHITE)); color ^= 1; } -- cgit v1.2.3