summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 5db2141..f517d06 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
#include <locale.h>
#include <stdio.h>
#include <string.h>
+#include <time.h>
#include "config.h"
#include "pieces.h"
@@ -285,7 +286,7 @@ int compute_coverage(int* board, int color) {
int compute_score(int* board) {
int coverage_score = compute_coverage(board, WHITE) - compute_coverage(board, BLACK);
- return compute_material_advantage(board, WHITE) + coverage_score;
+ return compute_material_advantage(board, WHITE) * 2 + coverage_score;
}
// Alpha-beta pruning
@@ -370,12 +371,15 @@ int main() {
input_move(move);
} else {
printf("Evaluating move for black...\n");
+ clock_t start, end;
int metrics = 0;
+ start = clock();
int value = find_best_move(move, board, color, 0, -INFINITY, +INFINITY, &metrics);
+ end = clock();
char move_in_notation[] = "xy XY";
index_to_notation(move[0], move_in_notation);
index_to_notation(move[1], move_in_notation + 3);
- printf("%i positions analyzed\n", metrics);
+ printf("[%i positions analyzed in %f seconds]\n", metrics, (double)(end - start) / CLOCKS_PER_SEC);
printf("Best move for black is %s with score %i in #%i moves\n", move_in_notation, value, MAX_DEPTH);
}