From 63ff6ead5af940356ab8f591ceffb8ae4ecf814b Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sun, 17 Jan 2021 01:23:37 -0500 Subject: Better status --- src/ctaklm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ctaklm.c') diff --git a/src/ctaklm.c b/src/ctaklm.c index 68441c0..d2208a0 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -298,8 +298,12 @@ load_ptn(const char* fn) { return EXIT_SUCCESS; } +static float sum_depth, num_check; + static void dot(const uint8_t depth) { + sum_depth += depth; + num_check += 1; if (depth == 0) { putchar('#'); fflush(stdout); @@ -314,14 +318,17 @@ ct1986_turn(const uint8_t max_depth) { fputs("]\033[26D",stdout); fflush(stdout); // Run the minimax + sum_depth = 0; num_check = 0; float minimax = ct1986_generate(max_depth); + printf("]\nChecked %.0f AvgD %.2f, ", + num_check, sum_depth/num_check); // Failed to find a move? if ((minimax <= -infty && (ply & 1) == 1) ||(minimax >= infty && (ply & 1) == 0)) { - puts("] Opponent concedes!"); + puts("Opponent concedes!"); return EXIT_FAILURE; } else { - printf("] Result: %s (%.3f)\n", + printf("Result: %s (%.3f)\n", ct1986_ptn, minimax*100.0); handle_turn(ct1986_ptn); -- cgit v1.3.1