From fff35bc5cde3b39c1f958b87c9296002ae76d142 Mon Sep 17 00:00:00 2001 From: tslil Date: Mon, 11 Jan 2021 14:15:31 -0500 Subject: Trying again with correct data generation --- src/pptdb.c | 57 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/pptdb.c b/src/pptdb.c index 9722780..5711dc7 100644 --- a/src/pptdb.c +++ b/src/pptdb.c @@ -21,28 +21,27 @@ write_input(void) { (float)(white_count & 127)/max_flats, (float)(black_count & 127)/max_flats); - // Top layer of stacks is handled differently to indicate stone type + // Write the board layers float val; - uint16_t mask = 1; - for (int k = 0; k < board_size * board_size; k++) { - val = 0; - if (COUNT_AT(k)>0) { - if (STONE_AT(k) == STONE_STANDING) { - val = (colours[k] & mask) ? +0.25 : -0.25; - } else if (STONE_AT(k) == STONE_CAPSTONE) { - val = (colours[k] & mask) ? +1.00 : -1.00; - } else { - val = (colours[k] & mask) ? +0.50 : -0.50; - } - } - fprintf(training_fh,"%.2f,", val); - } - // Layers underneath - for (int depth = 1; depth < max_depth; depth++) { - mask <<= 1; + for (int depth = 0; depth < max_depth; depth++) { for (int k = 0; k < board_size * board_size; k++) { val = 0; - if (COUNT_AT(k)>depth) val = (colours[k] & mask) ? +0.50 : -0.50; + if (depth == 0) { + // Top layer of stacks is handled differently to indicate + // stone type + if (COUNT_AT(k)>0) { + if (STONE_AT(k) == STONE_STANDING) { + val = (colours[k] & 1) ? +0.25 : -0.25; + } else if (STONE_AT(k) == STONE_CAPSTONE) { + val = (colours[k] & 1) ? +1.00 : -1.00; + } else { + val = (colours[k] & 1) ? +0.50 : -0.50; + } + } else { + // Layers underneath + if (COUNT_AT(k)>depth) val = (colours[k] & (1< 15) puts("Here"); + /* + * 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 > 15) { -- cgit v1.2.3