I have a basic search using alpha beta (negamax). I want to implement a transposition table, but I'm not sure if I am doing it correctly. Here's what I have in mind:
At the root:
- Store the depth, score, node type (PV), and best move
- When generating moves, look for the entry in the table
-----if found and (entry depth) = (depth - 1), retrieve the move and make it first
At the leaves:
- When evaluating, look for the entry in the table
-----If found and (entry depth) = 0, return the score from the table
-----If not found, calculate the score and return the score
----------Store the depth(0), score, and node type (PV) in the table
At the interior nodes:
- When evaluating, look for entry in the table
-----If found and (entry depth) >= depth
----------If it is a PV node, return the score from the table
----------If it is a CUT node, return score from the table if it is greater than current beta
- When generating moves, look for entry in the table
-----If found and (entry depth) = (depth -1)
-----------If it is a PV node or a CUT node, make that move first
- When storing the entry in the table
-----If alpha was raised but no beta cutoff, store the depth, score that raised alpha, node type (PV), and best move
-----If beta cutoff occurred, store the depth, score that exceeded beta, node type (CUT), and refutation move
Is the stuff above correct? Do I have to do anything for the ALL nodes?
Any help is appreciated. Thanks in advance.