AI Minmax Algo

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

MINIMAX SEARCH(GAME

PLAYING)
By –
Saurabh R, 54
Rohit K, 31
Nikhil A,2
Atharva P,50

Guided By – Prof. P. S . Dhabe


WHAT IS MINIMAX ALGORITHM?

Minimax is a kind of backtracking algorithm that is used in decision making and


game theory to find the optimal move for a player, assuming that your opponent
also plays optimally.

It is Originally formulated for two player game.

The Two players are considered as MAX(The player) and MIN(The opponent).

Max tries to maximize his score and Min tries to minimize it.
Number of Players : : 2 {MAX and
MIN}.

Task: : To find best move of MAX.


Game
Description Basis : : Assume opponent’s Best
move.

Play pattern : : Players play


alternatively.

Outcome : : Win, lose or draw.


Consider a game with 4 final states.

Which move you would make as a A : Optimal move is to go LEFT.


maximizing player considering that
your opponent also plays optimally?
STATIC EVALUATION FUNCTION

As seen in the previous slide, each leaf node had a value associated with it.

But in the real world when we are creating a program to play Tic-Tac-Toe, Chess, etc.
we need to implement a function that calculates the value of the board depending on
the placement of pieces on the board

Characteristics of the function are –

 Estimates how good the current board configuration is for a player


 Subtracts the opponents score from players
 If board evaluation is X for one player, then its –X for another player
Procedure for minimax : Cons : :

1. Generate whole game tree to leaves. It is computationally expensive to


generate the whole game tree
2. Apply Static evaluation function(Heuristic) to when the number of moves that a
leaves . player can make is a large number
and thus generating many final
3. Back-up values from leaves toward the root: states.
• Max node computes the max of its child
values.
• Min node computes the min of its child
values.

4. When the value reaches the root: choose


max value.
MINIMAX ALGORITHM ALPHA-BETA
PRUNING
 It is an optimization technique for minimax algorithm.
 It reduces the computation time by a huge factor.
 It cuts off branches in the game tree which need not be searched
because there already exists a better move available
 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 above.
ILLUSTRATION OF ALPHA-BETA CUT-OFF
PROPERTIES OF MINIMAX

• Complete? - Yes, if game tree is complete

• Optimal? -Yes, against a optimal opponent

• Time Complexity? O(b^m) { b is the branching factor, m is depth limit}

• Space Complexity? O(bm)


MINIMAX OVERVIEW

• It is the crux of most of computer board games


• Can work in real time (i.e not turn based)
• Applies to games where –
• Players take turns
• Underlying assumptions
• Have perfect information
APPLICATIONS
Chess Poker Dice
THANK YOU

You might also like