diff options
| author | tslil <tslil@posteo.de> | 2026-09-08 11:55:28 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-09-09 21:45:17 +0100 |
| commit | 1c9e266ae25f7f6067806d139e5971ce8513d2f6 (patch) | |
| tree | 9b935954310a56ee7fdba07db5f03888fc5af7b0 /include/pv.c | |
| parent | 7ef68374e8a58684b299b0f46f7ed850d5a87190 (diff) | |
~25% speedup in selfplay due to: incremental zobrist hashing, smarter road checking, re-using the input computed for the NN
Diffstat (limited to 'include/pv.c')
| -rw-r--r-- | include/pv.c | 5 |
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; |
