diff options
Diffstat (limited to 'include/negamax.c')
| -rw-r--r-- | include/negamax.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/negamax.c b/include/negamax.c index a970b83..30aed05 100644 --- a/include/negamax.c +++ b/include/negamax.c @@ -64,6 +64,8 @@ float negamax_generate(void) { } tt_free(); + action_to_ptn(negamax_best_action, negamax_ptn); + return result; } @@ -138,10 +140,6 @@ static float negamax(const uint8_t cur_depth, const uint8_t init_depth, if (node_value > best_value) { best_value = node_value; best_action = node->action; - if (cur_depth == init_depth) { - action_to_ptn(node->action, negamax_ptn); - negamax_best_action = best_action; - } } if (best_value > alpha) alpha = best_value; @@ -149,6 +147,7 @@ static float negamax(const uint8_t cur_depth, const uint8_t init_depth, } action_list_free(list); + if (cur_depth == init_depth) negamax_best_action = best_action; flag = TT_EXACT; if (best_value >= beta) flag = TT_LOWERBOUND; |
