aboutsummaryrefslogtreecommitdiff
path: root/src/pptdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pptdb.c')
-rw-r--r--src/pptdb.c17
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);
}
}