From fb48dd17615d7380d1b78bd6d32ebe7ea989af1f Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Tue, 26 Jan 2021 00:39:52 -0500 Subject: Once again, adding TT changes the outcome --- include/negamax.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include') 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; } -- cgit v1.2.3