diff options
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; } |
