diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-08-31 05:06:40 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-08-31 05:06:40 +0300 |
commit | ddb282a899fc61a124328cc79511a20cca60f655 (patch) | |
tree | 7009c80a7f5ebeaa897f9e856e384c8fe83bc2ca | |
parent | 4a99286f1bb9213467cf12f787d993dde2727764 (diff) | |
download | c-chess-ddb282a899fc61a124328cc79511a20cca60f655.tar.gz |
feat: display current score
-rw-r--r-- | src/config.h | 4 | ||||
-rw-r--r-- | 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 @@ -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; } |