aboutsummaryrefslogtreecommitdiff
path: root/src/pptdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pptdb.c')
-rw-r--r--src/pptdb.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/pptdb.c b/src/pptdb.c
index 35aa325..7d8026d 100644
--- a/src/pptdb.c
+++ b/src/pptdb.c
@@ -6,7 +6,7 @@
float max_flats;
uint64_t heights[16];
-int result, generate;
+int outcome_black, generate;
FILE *training_fh = NULL;
const int max_depth = 8;
@@ -54,9 +54,7 @@ parse_line(const char *pt, const ssize_t read) {
for (idx=0;idx<read;idx++) {
if (pt[idx]==',') total_plies++;
}
-
- idx=0;
- for(;;) {
+ for(idx=0;;) {
if (pt[idx] == 'P') {
// P [A-F][1-6] [CF]?,
idx+=2;
@@ -75,12 +73,6 @@ parse_line(const char *pt, const ssize_t read) {
r = try_place(THE_COORDS(col,row), current_colour, stone);
if (r != ACT_OK) return r;
-
- /*
- * char buf[20];
- * generate_place(board_size, THE_COORDS(col,row), stone, buf);
- * puts(buf);
- */
} else if (pt[idx] == 'M') {
// M [A-F][1-6] [A-F][1-6]( [1-6])+,
idx+=2;
@@ -111,22 +103,11 @@ parse_line(const char *pt, const ssize_t read) {
if (COUNT_AT(k)>1) heights[COUNT_AT(k)]+=1;
}
}
-
- /*
- * char buf[20];
- * generate_move(board_size, THE_COORDS(s_col, s_row), dir, steps, drops, buf);
- * puts(buf);
- */
}
-
- /*
- * if (current_colour == C_BLACK && ply > 15) puts("Here");
- */
-
// Generate training data, not too early in the game
if (generate && current_colour == C_BLACK && ply > total_plies - 5) {
write_input();
- fprintf(training_fh,"%d,%d\n", result, 1-result);
+ fprintf(training_fh,"%d\n", outcome_black);
}
// Parse next action
while (idx<read && pt[idx++]!=',');
@@ -172,15 +153,15 @@ main(int argc, char **argv) {
fprintf(training_fh,"\"Stack %d %d\",",depth,k);
}
}
- fputs("\"White win\",\"Black win\"\n",training_fh);
+ fputs("\"Outcome\"\n",training_fh);
} else generate=0;
while ((read = getline(&line, &len, playtak_fh)) != -1) {
// Reset everything
reset_state(size);
- // Store the result of this game
- if (line[read-4] == '0') result = 0;
- else result = 1;
+ // Store the outcome of this game. Black win = 1
+ 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