aboutsummaryrefslogtreecommitdiff
path: root/include/pv.c
diff options
context:
space:
mode:
Diffstat (limited to 'include/pv.c')
-rw-r--r--include/pv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/pv.c b/include/pv.c
index 9c120f5..94c00d1 100644
--- a/include/pv.c
+++ b/include/pv.c
@@ -38,9 +38,10 @@ static float terminal_value(const enum WIN_TYPE winner) {
void pv_capture_leaf(pv_leaf_t *leaf, tak_state_p state,
const enum WIN_TYPE winner) {
- nn_prepare_head(leaf->head, state);
- nn_cell_idxs(leaf->cells, state);
const uint8_t n_cells = state->board_size * state->board_size;
+ nn_prepare_head(leaf->head, state);
+ if (!nn_last_cell_idxs(leaf->cells, state))
+ nn_cell_idxs(leaf->cells, state);
for (uint8_t loc = n_cells; loc < PV_MAX_CELLS; loc++)
leaf->cells[loc] = 0;
leaf->current_colour = (uint8_t)state->current_colour;