Negamax Search
- Search nodes include the following data:
- Board Configuration
- Which player is about to move
- Starting node
- Current board configuration
- Current player
- We will call the current player in the starting node
the protagonist.
- The protagonist's opponent we will call the adversary.
- Generating successor nodes
- Select a legal move for the moving player
- Generate a new board position resulting from that move
- Make the other player the moving player
- If the game is over, no successor nodes should be generated.
- Evaluating a node
- Terminating nodes:
- If the adversary wins, return -1.
- If the protagonist wins, return 1.
- If the game is a tie, return 0.
- Interior nodes:
- Call NegaMax recursively.
- Negate the return value.
- Selecting a node
- Having evaluated all successor nodes, return the node of maximum value.
- Evaluation Functions
- Due to depth cutoffs, terminal nodes are not always reached.
- A board evaluation function provides an estimate
of whether a node will lead to an eventual win or loss for the protagonist.
- This estimate is a real number between -1 and 1.
- Negate the number if the current player is the adversary.