From de4f20f28afe23ecfc546ad242e5bb44710996cc Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Tue, 26 Jan 2021 17:42:53 -0500 Subject: Storing best moves! --- include/tt_treap.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'include/tt_treap.c') diff --git a/include/tt_treap.c b/include/tt_treap.c index b48ffd4..369d767 100644 --- a/include/tt_treap.c +++ b/include/tt_treap.c @@ -12,10 +12,14 @@ static tt_entry_t * root; // =================================================================== void recurse_tree(tt_entry_t *n); -tt_entry_t *new_treap_node(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value); void bubble_up(tt_entry_t *n); +tt_entry_t * +new_treap_node(const uint64_t key, const enum TT_FLAG flag, + const uint8_t depth, const float value, + const action_t action); + + // =================================================================== // Exported functions // =================================================================== @@ -43,8 +47,9 @@ tt_entry_t *tt_seek(const uint64_t key) { } int tt_insert(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value) { - tt_entry_t *m = new_treap_node(key, flag, depth, value); + const uint8_t depth, const float value, + const action_t action) { + tt_entry_t *m = new_treap_node(key, flag, depth, value, action); if (root == NULL) { root = m; tt_num_cached = 1; @@ -78,8 +83,10 @@ void recurse_tree(tt_entry_t *n) { free(n); } -tt_entry_t *new_treap_node(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value) { +tt_entry_t * +new_treap_node(const uint64_t key, const enum TT_FLAG flag, + const uint8_t depth, const float value, + const action_t action) { tt_entry_t *n = malloc(sizeof(struct treap_node_s)); // TODO: trap n->key = key; @@ -89,6 +96,7 @@ tt_entry_t *new_treap_node(const uint64_t key, const enum TT_FLAG flag, n->left = NULL; n->right = NULL; n->parent = NULL; + n->action = action; XORSHIFT64; n->weight = RANDOM32; return n; } -- cgit v1.3.1