aboutsummaryrefslogtreecommitdiff
path: root/include/negamax.c
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2021-06-01 15:20:48 -0400
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit0deb42134cb7f0ed6ec809c3de1052ab2dfe2235 (patch)
tree1ecd7fbda98295dde19c09d9b7383b9ea2c73a45 /include/negamax.c
parent29536c86457d83967c23a900574182b3898f04dd (diff)
Trying to make things faster
I tried the following, but they all made things worse: - moving away from the singly-linked (tail tracking) list for actions by: + using an array zipper for a deque + using an array to poorly hold a floating deque - caching the results of generating move lists in the transposition table and then + copying the resulting list/zip/deque instead of generating it + applying the move-to-front without copying, but this made the search order worse. Presumably in this case shallower nodes were messing up the search tree with garbage moves? I think some of this is not supposed to happen, but i have just the right combination of poor evaluation function and naively ordered and cheap move generation that i'm in a local minimum here.
Diffstat (limited to 'include/negamax.c')
-rw-r--r--include/negamax.c7
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;