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 /src/main.c | |
parent | 4a99286f1bb9213467cf12f787d993dde2727764 (diff) | |
download | c-chess-ddb282a899fc61a124328cc79511a20cca60f655.tar.gz |
feat: display current score
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; } |