Open Lines Heuristic
Define an open line for player as a row/column/diagonal with no opponent mark. We use the heuristic:


Thus, for this board, we would have .
Evaluation Function
We can adapt the above heuristic to become , where
- is the total number of my (MAX) possible winning lines
- is the total number of opponent’s (MIN) possible winning lines
- is the total evaluation for state

Now, we use Minimax to solve the problem:
- Generate the game tree
- Apply the utility function to each terminal state to get its value
- Use these values to determine the utility of nodes one level higher up int he search tree.
- From bottom to top:
- For a MAX level, select the maximum level of its successors
- For a MIN level, select the minimum value of its successors
Decision rule: From the root node, select the move which leads to the highest value.



