diff options
| author | tslil <tslil@posteo.de> | 2021-01-06 00:43:18 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | c2227f2c115ee536ffa22b32866d3a68437dba73 (patch) | |
| tree | 0ea572dda0db03ca49dcd857f768beee756166c0 /src/pptdb.c | |
| parent | 467128c57e23785abc3e80462c05c2f2abbc0679 (diff) | |
On the hunt for a better representation
Diffstat (limited to 'src/pptdb.c')
| -rw-r--r-- | src/pptdb.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/pptdb.c b/src/pptdb.c index 712aabc..7a26ffd 100644 --- a/src/pptdb.c +++ b/src/pptdb.c @@ -19,28 +19,29 @@ write_input(void) { // Two layers of board_size * board_size: float t; int h; uint16_t mask; for (int k = 0; k < board_size * board_size; k++) { - // stacks encoded as balanced ternary, without caps and walls + // stacks encoded as balanced ternary t = 0; h = COUNT_AT(k); + if (h>0) { mask = 1<<(h-1); - /* if (STONE_AT(k) != STONE_FLAT) h--; */ while (h-->0) { - t += (colours[k] & mask) ? +1.0 : -1.0; - t /= 3; + t += (colours[k] & mask) ? +1 : -1; + t/=3; mask >>= 1; } } fprintf(training_fh,"%.6f,",t); } - int val; + float val; for (int k = 0; k < board_size * board_size; k++) { val = 0; if (COUNT_AT(k)) { - if (STONE_AT(k) == STONE_STANDING) val = (colours[k] & 1) ? +1 : -1; - else if (STONE_AT(k) == STONE_CAPSTONE) val = (colours[k] & 1) ? +2 : -2; + if (STONE_AT(k) == STONE_STANDING) val = (colours[k] & 1) ? +1/3 : -1/3; + else if (STONE_AT(k) == STONE_CAPSTONE) val = (colours[k] & 1) ? +1.0 : -1.0; + else val = (colours[k] & 1) ? +2/3 : -2/3; } - fprintf(training_fh,"%d,",val); + fprintf(training_fh,"%.6f,",val); } } |
