diff options
| author | tslil <tslil@posteo.de> | 2021-01-11 14:15:31 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | fff35bc5cde3b39c1f958b87c9296002ae76d142 (patch) | |
| tree | 6adc6367cef2d6a0e1b470dd7fcb0a24772f21a6 /src/pptdb.c | |
| parent | 8f5c729a014db65e481d025700930a34358181ef (diff) | |
Trying again with correct data generation
Diffstat (limited to 'src/pptdb.c')
| -rw-r--r-- | src/pptdb.c | 57 |
1 files changed, 31 insertions, 26 deletions
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<<depth)) ? +0.50 : -0.50; + } + } fprintf(training_fh,"%.2f,", val); } } @@ -90,9 +89,11 @@ 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); + /* + * 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])+, @@ -125,12 +126,16 @@ parse_line(const char *pt, const ssize_t read) { } } - char buf[20]; - generate_move(board_size, THE_COORDS(s_col, s_row), dir, steps, drops, buf); - puts(buf); + /* + * 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"); + /* + * 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) { |
