From a8f69f1262bd76ab311ebe760f314fa6e4526d15 Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Mon, 18 Jan 2021 13:43:49 -0500 Subject: Toying with symmetrising data --- src/pptdb.c | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'src/pptdb.c') diff --git a/src/pptdb.c b/src/pptdb.c index b1d91ce..5c5c718 100644 --- a/src/pptdb.c +++ b/src/pptdb.c @@ -12,7 +12,7 @@ int generate, outcome_black; const int max_depth = 6; static void -write_input(void) { +write_input(const int dx, const int dy) { // Two numbers for flats remaining fprintf(training_fh,"%.8f,%.8f,", (float)(white_count & 127)/max_flats, @@ -20,28 +20,37 @@ write_input(void) { // Write the board layers float val; + int col, row; for (uint8_t depth = 0; depth < max_depth; depth++) { - for (uint8_t k = 0; k < board_size * board_size; k++) { - val = 0; - if (COUNT_AT(k)>depth) { - if (depth == 0) { - // Top layer of stacks is handled differently to indicate - // stone type - 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; + row = (dy>0)?-1:board_size; + for (int i = 0; i < board_size; i++) { + row += dy; + col = (dx>0)?-1:board_size; + for (int j = 0; j < board_size; j++) { + col += dx; + const uint8_t k = THE_COORDS(col, row); + val = 0; + if (COUNT_AT(k)>depth) { + if (depth == 0) { + // Top layer of stacks is handled differently to indicate + // stone type + 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 { - val = (colours[k] & 1) ? +0.50 : -0.50; + // Layers underneath + val = (colours[k] & (1<= total_plies) { - write_input(); - fprintf(training_fh,"%d\n", outcome_black); + /* + * int dx = (rand()&1)?-1:+1; + * int dy = (rand()&1)?-1:+1; + */ + write_input(1,1); + write_input(1,-1); + write_input(-1,1); + write_input(-1,-1); } // Parse next action while (idx