2. Minimax Algorithm (Tic Tac Toe)
Initial State:
1 0 0
0 1
1
Evaluation Function at Leaf
Node : 1 for win and 0 for draw
Transfer of evaluation function:
- Min node → min value
- Max node → max value
10. Alpha Beta Pruning (Example)
Initially, assign alpha and beta to negative infinity and infinity
respectively.
Pass the valid bound to the first leaf node using depth first search
technique.
12. Alpha Beta Pruning (Example)
When we reach to the first leaf node, we run the evaluation function and
get the value of 3.
We pass back to the min node above. Since it is min node, we decrease
beta value to 3.
Next, we generate the next child from that node and run evalutation
function and return a value of 17 to the min node. Since, beta can never
increase at min node, the value of beta remains 3.
14. Alpha Beta Pruning (Example)
The value 3 from the min node is passed to max node above. So, alpha
becomes 3.
Get the next child and pass the bounds along. Same process as before
is repeated and we get alpha = 3 and beta = 2 at first child min node.
Since the bound can never be found i.e a number greater than alpha (3)
and less than beta (2), we stop evaluating further and other childs from
that node are pruned. This is called beta pruning. It returns the beta
value (2) to the parent max node. As max node can not decrease value
of alpha, it remains as it is i.e. 3.