Minimax Pseudocode
alpaBetaMinimax(node, alpha, beta)
"""
Returns best score for the player associated with the given node.
Also sets the variable bestMove to the move associated with the
best score at the root node or None if no move is available.
"""
# check if at depth limit
if depth(node) == depthLimit
return staticEval(node)
# check if at leaf
children = successors(node)
if len(children) == 0
if node is root
bestMove = None
return staticEval(node)
# initialize bestMove when searching
if node is root
bestMove = operator(children[0])
# check if there is only one option
if len(children) == 1
return staticEval(children[0])
if it is MAX's turn to move
for child in children
result = alphaBetaMinimax(child, alpha, beta)
if result > alpha
alpha = result
if node is root
bestMove = operator of child
if alpha >= beta
return alpha
return alpha
if it is MIN's turn to move
for child in children
result = alphaBetaMinimax(child, alpha, beta)
if result < beta
beta = result
if node is root
bestMove = operator of child
if beta <= alpha
return beta
return beta