From bea769b801893a6841902b91e06f495ef9622dc1 Mon Sep 17 00:00:00 2001 From: tslil Date: Tue, 12 Jan 2021 21:47:58 -0500 Subject: Have to account for CPS --- include/ct1975.c | 7 +++++-- src/ctaklm.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/ct1975.c b/include/ct1975.c index c0256eb..5cb47e9 100644 --- a/include/ct1975.c +++ b/include/ct1975.c @@ -99,7 +99,7 @@ ct1975_evaluate_black_win(void) { char ct1975_ptn[9]; float ct1975_optimal; -#define BETTER(t,o) ((current_colour == C_BLACK && (t) > (o)) || (current_colour == C_WHITE && (t) < (o))) +#define BETTER(t,o) ((ply>2 && ((current_colour == C_BLACK && (t) > (o)) || (current_colour == C_WHITE && (t) < (o)))) || (ply<3 && ((current_colour == C_BLACK && (o) > (t)) || (current_colour == C_WHITE && (o) < (t))))) void ct1975_generate_ptn(void display_progress(void)) { @@ -111,7 +111,10 @@ ct1975_generate_ptn(void display_progress(void)) { black_count_backup = black_count; // 1.0 is a `certain' black win, 0.0 is a `certain' white win. - ct1975_optimal = (current_colour == C_BLACK) ? 0.0 : 1.0; + if (ply > 2) + ct1975_optimal = (current_colour == C_BLACK) ? 0.0 : 1.0; + else + ct1975_optimal = (current_colour == C_BLACK) ? 0.1 : 0.0; // Step across the board for (uint8_t row = 0; row < board_size; row++) { diff --git a/src/ctaklm.c b/src/ctaklm.c index 13326f9..aafc0c3 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -357,7 +357,7 @@ main(int argc, char **argv) { } } else { int r = handle_turn(line); - if (r == EXIT_SUCCESS) { + if (r == EXIT_SUCCESS && won == 0xFF) { fputs("Thinking [", stdout); ct1975_generate_ptn(&dot); printf("] Result: %s (%.3f)\n", -- cgit v1.2.3