summaryrefslogtreecommitdiff
path: root/src/pptdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pptdb.c')
-rw-r--r--src/pptdb.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/pptdb.c b/src/pptdb.c
index 266d846..a67be1d 100644
--- a/src/pptdb.c
+++ b/src/pptdb.c
@@ -4,9 +4,9 @@
#include <tak.h>
-float max_flats;
+int generate;
uint64_t heights[16];
-int outcome_black, generate;
+float max_flats, outcome_black;
FILE *training_fh = NULL;
const int max_depth = 8;
@@ -105,9 +105,13 @@ parse_line(const char *pt, const ssize_t read) {
}
}
// Generate training data, not too early in the game
- if (generate && current_colour == C_BLACK && ply + 5 > total_plies) {
+ if (generate && ply + 5 > total_plies) {
write_input();
- fprintf(training_fh,"%d\n", outcome_black);
+ 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);
}
// Parse next action
while (idx<read && pt[idx++]!=',');
@@ -160,8 +164,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 = 1;
- else outcome_black = 0;
+ if (line[read-4] == '0') outcome_black = 0.99;
+ else outcome_black = 0.01;
// Parse the line
r = parse_line(line,read-4);
// Adjust counts if we're not generating training data