Module-2 Lecture 7
Module-2 Lecture 7
LECTURE-7
Minimax
Algorith
m
Introduction
to Minimax Algorithm
In the next step, it's a turn for minimizer, so it will compare all nodes value
with +∞, and will find the 3rd layer node values.
•Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in
the finite search tree.
•Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.
•Time complexity- As it performs DFS for the game-tree, so the time complexity of Min-
Max algorithm is O(bm), where b is branching factor of the game-tree, and m is the
maximum depth of the tree.
The main drawback of the minimax algorithm is that it gets really slow for complex
games such as Chess, go, etc. This type of games has a huge branching factor, and the
player has lots of choices to decide. This limitation of the minimax algorithm can be
improved from alpha-beta pruning which we have discussed in the next topic.
PRACTISE
EXAMPLES
•L3N1 = -2
•L3N2 = 3
•L3N3 = 1
•L3N4 = 5
•L3N5 = -4
•L3N6 = -6
•L3N7 = 0
•L3N8 = 6
PRACTISE PRACTISE
EXAMPLE-2 EXAMPLE-3
Alpha-Beta Pruning
•Alpha-beta pruning is a modified version of the minimax algorithm. It is an
optimization technique for the minimax algorithm.
Alpha is the best value that the maximizer currently can guarantee at that level or
above.
Beta is the best value that the minimizer currently can guarantee at that level or
below.
Working of Alpha-Beta Pruning:
•Worst ordering: In some cases, alpha-beta pruning algorithm does not prune any of
the leaves of the tree, and works exactly as minimax algorithm. In this case, it also
consumes more time because of alpha-beta factors, such a move of pruning is called
worst ordering. In this case, the best move occurs on the right side of the tree. The time
complexity for such an order is O(bm).
•Ideal ordering: The ideal ordering for alpha-beta pruning occurs when lots of pruning
happens in the tree, and best moves occur at the left side of the tree. We apply DFS
hence it first search left of the tree and go deep twice as minimax algorithm in the same
amount of time. Complexity in ideal ordering is O(b m/2).
Examples
THANK YOU