From cf7d665598e34e32d258775b583968e758c8f2fb Mon Sep 17 00:00:00 2001 From: tslil Date: Wed, 13 Jan 2021 23:41:32 -0500 Subject: Fixed minimax (!), fixed bugs in tak.c With minimax of depth 1 the evaluation function seems alright with the current method of training and generating weights --- src/ctaklm.c | 2 +- src/pptdb.c | 14 +++++--------- src/train5.py | 22 ++++++++++++++++------ 3 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ctaklm.c b/src/ctaklm.c index 4060911..9d0f867 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -366,7 +366,7 @@ main(int argc, char **argv) { int r = handle_turn(line); if (r == EXIT_SUCCESS && won == 0xFF) { fputs("Thinking [", stdout); - float minimax = ct1986_minimax(0, 2, 0); + float minimax = ct1986_minimax(0, 1, 0); printf("] Result: %s (%.3f)\n", ct1986_ptn, minimax*100.0); diff --git a/src/pptdb.c b/src/pptdb.c index a67be1d..dbadfdf 100644 --- a/src/pptdb.c +++ b/src/pptdb.c @@ -4,10 +4,10 @@ #include -int generate; +float max_flats; uint64_t heights[16]; -float max_flats, outcome_black; FILE *training_fh = NULL; +int generate, outcome_black; const int max_depth = 8; @@ -107,11 +107,7 @@ parse_line(const char *pt, const ssize_t read) { // Generate training data, not too early in the game if (generate && ply + 5 > total_plies) { write_input(); - if (ply >= total_plies) { - if (outcome_black > 0.5) outcome_black = 1.0; - else outcome_black = 0.0; - } - fprintf(training_fh,"%.2f\n", outcome_black); + fprintf(training_fh,"%df\n", outcome_black); } // Parse next action while (idx