diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-26 17:42:53 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | de4f20f28afe23ecfc546ad242e5bb44710996cc (patch) | |
| tree | 32cd0cf0757327cee4ee4d4631920284d54816f3 /include/tt_treap.c | |
| parent | d45db690ce92cb2c847175cfd9ac497f3dd40cea (diff) | |
Storing best moves!
Diffstat (limited to 'include/tt_treap.c')
| -rw-r--r-- | include/tt_treap.c | 20 |
1 files changed, 14 insertions, 6 deletions
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; } |
