summaryrefslogtreecommitdiff
path: root/src/pptdb.c
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2021-01-13 23:41:32 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commitcf7d665598e34e32d258775b583968e758c8f2fb (patch)
tree6bfda86535ffa051afd8ccfd70f1d4488701dfdf /src/pptdb.c
parent2ef0078ba2afd99c4fc2673497f3d3a39119cf5d (diff)
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
Diffstat (limited to 'src/pptdb.c')
-rw-r--r--src/pptdb.c14
1 files changed, 5 insertions, 9 deletions
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 <tak.h>
-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<read && pt[idx++]!=',');
@@ -164,8 +160,8 @@ main(int argc, char **argv) {
// Reset everything
reset_state(size);
// Store the outcome of this game. Black win = 1
- if (line[read-4] == '0') outcome_black = 0.99;
- else outcome_black = 0.01;
+ if (line[read-4] == '0') outcome_black = 1;
+ else outcome_black = 0;
// Parse the line
r = parse_line(line,read-4);
// Adjust counts if we're not generating training data