git.haldean.org grandmaster / 8e86f95
attach pgn to board structs and game states Haldean 3 years ago
3 changed file(s) with 6 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
8383 int8_t passant_file;
8484 /* ply index is the number of plys that have been played, inclusive. */
8585 uint16_t ply_index;
86 /* PGN is the PGN for the game played up until this point. */
87 char *pgn;
8688 };
8789
8890 /* Returns the opposite color of the given color. */
339339 result->post_board->access_map = calloc(1, sizeof(struct access_map));
340340 build_access_map(result, result->post_board->access_map);
341341 result->post_board->ply_index = 1 + result->parent->post_board->ply_index;
342 result->post_board->pgn = create_pgn(result);
342343
343344 free(notation_head);
344345 *out = result;
148148 }
149149 json_set(board_root, "access_map", map_array);
150150
151 json_set(board_root, "ply_index", json_integer(board->ply_index));
152 json_set(board_root, "pgn", json_string(board->pgn));
153
151154 return board_root;
152155 }
153156