diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-26 00:39:52 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | fb48dd17615d7380d1b78bd6d32ebe7ea989af1f (patch) | |
| tree | 2d660e09d35286ed4453869d26abc6a8b10a5595 /include | |
| parent | 3d8b8a5179a9684d8b7c77c7015b17b95f7dd701 (diff) | |
Once again, adding TT changes the outcome
Diffstat (limited to 'include')
| -rw-r--r-- | include/negamax.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/negamax.c b/include/negamax.c index f6c4873..db5d39b 100644 --- a/include/negamax.c +++ b/include/negamax.c @@ -114,6 +114,24 @@ static enum WIN_TYPE w; static float negamax(const uint8_t cur_depth, float alpha, float beta, const float colour) { + + /* + * uint64_t hash = zobrist_compute(); + * tt_entry_t *entry = tt_seek(hash); + * const float alpha_orig = alpha; + * + * if (entry != NULL && entry->depth >= cur_depth) { + * if (entry->flag == TT_EXACT) { + * return entry->value; + * } else if (entry->flag == TT_LOWERBOUND) { + * alpha = fmax(alpha, entry->value); + * } else if (entry->flag == TT_UPPERBOUND) { + * beta = fmin(beta, entry->value); + * } + * if (alpha >= beta) return entry->value; + * } + */ + float value = -infty; action_list_t *list = action_list_generate(); @@ -153,6 +171,21 @@ negamax(const uint8_t cur_depth, float alpha, float beta, } action_list_free(list); + + /* + * enum TT_FLAG flag = TT_EXACT; + * if (value <= alpha_orig) flag = TT_UPPERBOUND; + * else if (value >= beta) flag = TT_UPPERBOUND; + * + * if (entry == NULL) { + * tt_insert(hash, flag, cur_depth, value); + * } else { + * entry->flag = flag; + * entry->value = value; + * entry->depth = cur_depth; + * } + */ + return value; } |
