attach pgn to board structs and game states
Haldean
3 years ago
83 | 83 |
int8_t passant_file;
|
84 | 84 |
/* ply index is the number of plys that have been played, inclusive. */
|
85 | 85 |
uint16_t ply_index;
|
|
86 |
/* PGN is the PGN for the game played up until this point. */
|
|
87 |
char *pgn;
|
86 | 88 |
};
|
87 | 89 |
|
88 | 90 |
/* Returns the opposite color of the given color. */
|
339 | 339 |
result->post_board->access_map = calloc(1, sizeof(struct access_map));
|
340 | 340 |
build_access_map(result, result->post_board->access_map);
|
341 | 341 |
result->post_board->ply_index = 1 + result->parent->post_board->ply_index;
|
|
342 |
result->post_board->pgn = create_pgn(result);
|
342 | 343 |
|
343 | 344 |
free(notation_head);
|
344 | 345 |
*out = result;
|
148 | 148 |
}
|
149 | 149 |
json_set(board_root, "access_map", map_array);
|
150 | 150 |
|
|
151 |
json_set(board_root, "ply_index", json_integer(board->ply_index));
|
|
152 |
json_set(board_root, "pgn", json_string(board->pgn));
|
|
153 |
|
151 | 154 |
return board_root;
|
152 | 155 |
}
|
153 | 156 |
|