aboutsummaryrefslogtreecommitdiff
path: root/include/negamax.c
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-28 20:46:43 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit473797d820b3b224ee1d370a50e4bcd01d09d48e (patch)
treec68258a01aeca20efea507b6a69b8de03ae3c4e7 /include/negamax.c
parent1c4fab6ffb9bc0fd71d79ae047f1bd524134e122 (diff)
Print progress before recursion rather than after
Diffstat (limited to 'include/negamax.c')
-rw-r--r--include/negamax.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/negamax.c b/include/negamax.c
index cfe2643..3db5867 100644
--- a/include/negamax.c
+++ b/include/negamax.c
@@ -59,7 +59,7 @@ negamax(const uint8_t cur_depth, float alpha, float beta,
uint64_t hash = zobrist_compute();
tt_entry_t *entry = tt_seek(hash);
- // CAUTION: >= breaks search stability
+ // CAUTION: ≥ breaks search stability (vs =) on shallow depths
if (entry != NULL && entry->depth >= cur_depth) {
if (entry->flag == TT_EXACT) {
return entry->value;
@@ -84,6 +84,7 @@ negamax(const uint8_t cur_depth, float alpha, float beta,
float best_value = -infty;
for (action_node_t *node=list->head; node!=NULL; node=node->next) {
+ negamax_display_progress(cur_depth, list->length);
action_take(node->action);
@@ -105,8 +106,6 @@ negamax(const uint8_t cur_depth, float alpha, float beta,
}
action_undo(node->action);
- negamax_display_progress(cur_depth, list->length);
-
if (node_value > best_value) {
best_value = node_value;
best_action = node->action;