aboutsummaryrefslogtreecommitdiff
path: root/src/pptdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pptdb.c')
-rw-r--r--src/pptdb.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pptdb.c b/src/pptdb.c
index 557b894..e3fd687 100644
--- a/src/pptdb.c
+++ b/src/pptdb.c
@@ -32,7 +32,7 @@ int generate, outcome_black;
const int max_depth = 6;
static void
-write_input(const int dx, const int dy) {
+write_input(const int dx, const int dy, const uint8_t swap) {
// Two numbers for flats remaining
fprintf(training_fh,"%.8f,%.8f,",
(float)(white_count & 127)/max_flats,
@@ -48,7 +48,8 @@ write_input(const int dx, const int 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);
+ const uint8_t k =
+ (swap) ? THE_COORDS(row, col) : THE_COORDS(col, row);
val = 0;
if (COUNT_AT(k)>depth) {
if (depth == 0) {
@@ -136,10 +137,10 @@ parse_line(const char *pt, const ssize_t read) {
// Generate training data, not too early in the game, all
// orientations
if (generate && ply + 4 >= total_plies) {
- write_input(-1,-1);
- write_input(-1,+1);
- write_input(+1,-1);
- write_input(+1,+1);
+ write_input(-1, -1, 0); write_input(-1, -1, 1);
+ write_input(-1, +1, 0); write_input(-1, +1, 1);
+ write_input(+1, -1, 0); write_input(+1, -1, 1);
+ write_input(+1, +1, 0); write_input(+1, +1, 1);
}
// Parse next action
while (idx<read && pt[idx++]!=',');