Negamax search is a variant form of minimax search that relies on the zero-sum property of a two-player game. More precisely, the value of a position to player A in alpha beta pruning in artificial intelligence pdf a game is the negation of the value to player B.

Thus, the player on move looks for a move that maximizes the negation of the value resulting from the move: this successor position must by definition have been valued by the opponent. The reasoning of the previous sentence works regardless of whether A or B is on move. This means that a single procedure can be used to value both positions.

This is a coding simplification over minimax, which requires that A selects the move with the maximum-valued successor while B selects the move with the minimum-valued successor. It should not be confused with negascout, an algorithm to compute the minimax or negamax value quickly by clever use of alpha-beta pruning discovered in the 1980s. Note that alpha-beta pruning is itself a way to compute the minimax or negamax value of a position quickly by avoiding the search of certain uninteresting positions.

Most adversarial search engines are coded using some form of negamax search. Transitions to child nodes represent moves available to a player who’s about to play from a given node. The negamax search objective is to find the node score value for the player who is playing at the root node.

The root node inherits its score from one of its immediate child nodes. The child node that ultimately sets the root node’s best score also represents the best move to play.

Assuming basic negamax, only the node’s best score is essential with non-root nodes. And the node’s best move isn’t necessary to retain nor return for those nodes. What can be confusing is how the heuristic value of the current node is calculated. In this implementation, this value is always calculated from the point of view of player A, whose color value is one.

In other words, higher heuristic values always represent situations more favorable for player A. This is the same behavior as the normal minimax algorithm.