From 0ed59835decdc839d58463cc16441be7a4cb36e2 Mon Sep 17 00:00:00 2001 From: tslil Date: Mon, 11 Jan 2021 17:24:58 -0500 Subject: Hopefully removed all layer bugs --- src/pptdb.c | 54 ++++++++++++++---------------------------------------- 1 file changed, 14 insertions(+), 40 deletions(-) (limited to 'src/pptdb.c') diff --git a/src/pptdb.c b/src/pptdb.c index 5711dc7..773962f 100644 --- a/src/pptdb.c +++ b/src/pptdb.c @@ -13,9 +13,6 @@ const int max_depth = 8; static void write_input(void) { - // Whose turn is it? - /* fprintf(training_fh,"%d,",current_colour == C_BLACK); */ - // Two numbers for flats remaining fprintf(training_fh,"%.8f,%.8f,", (float)(white_count & 127)/max_flats, @@ -23,13 +20,13 @@ write_input(void) { // Write the board layers float val; - for (int depth = 0; depth < max_depth; depth++) { - for (int k = 0; k < board_size * board_size; k++) { + for (uint8_t depth = 0; depth < max_depth; depth++) { + for (uint8_t k = 0; k < board_size * board_size; k++) { val = 0; - if (depth == 0) { - // Top layer of stacks is handled differently to indicate - // stone type - if (COUNT_AT(k)>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) { @@ -39,29 +36,12 @@ write_input(void) { } } else { // Layers underneath - if (COUNT_AT(k)>depth) val = (colours[k] & (1<>=1; - * } - * fprintf(training_fh,"%.8f,",2*t); - * } - */ - } // Warning: performs _no_ checks on input whatsoever @@ -89,11 +69,9 @@ 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])+, @@ -126,16 +104,12 @@ 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) { -- cgit v1.3.1