MCSE601L - ARTIFICIAL I NTELLIGENCE
11/14/2022 1
ARTIFICIAL I NTELLIGENCE
M ODULE - 3
• Global Optimization Algorithms
• Genetic Algorithms
• Particle Swarm Optimization Algorithm
• Ant Colony Optimization
• Gravitational Search Algorithm
• Games
• Optimal Decisions in Games
• Minimax Algorithm
• Alpha-Beta Pruning Algorithm
11/14/2022 2
Game Playing
• Game playing is one of the oldest sub-filed of AI.
• Game playing involves abstract and pure form of competition that seems to require
intelligence
• It is easy to represent the state and actions
• To implement game playing is required very little world knowledge
• The most common used AI technique in game is search
• Game playing research has contributed ideas on how to make the best use of time to
reach good decisions
• Game playing is a search problem defined by:
• Initial state of the game
• Operators defining legal moves
• Successor function
• Terminal test defining end of game states
• Goal test
• Path cost/ utility/ payoff function
3
Game Playing
Characteristics of game playing:
• There is always an “Unpredictable” opponent:
• Due to their uncertainty
• He/she also wants to win
• Solution for each problem is a strategy, which specifies a move for every
possible opponent reply
• Time Limits:
• Games are often played under strict time constraints and therefore must be
very effectively handled
• There are special games where the two players have exactly opposite
goals.
• It can be divided into two types
• Perfect Information games (where both players have access
to the same information)
• Imperfect Information games (different information can be
accessed)
4
Game Playing
Optimal Decisions in Games
Minimax Algorithm
• Minimax is a kind of backtracking algorithm that is used in game
theory to find optimal move for a player
• It is widely used in two player turn based games
Example: chess, Checkers, tic-tac toe
• MIN and MAX are two game players
• MAX Highest value
• Min Lowest value
• First move performed by MAX then turn is given to MIN and so on
until the game is over
5
Game Playing
Optimal Decisions in Games -Minmax Algorithm
• A loser need to pay penalties and game points or credits are gifted to
the winning player, at end of the game
• A game is defined as a search problem and broadly defined by the
following components
1. The Initial State: It is start state position on the board, which
leads to further move
2. A successor function: It is collection of (move, state) pairs,
each specifies a legal move and output state. Here actions are
considered
3. Terminal Test: It is final state which declares that the game
is over or ended or terminal states
6
Game Playing
Optimal Decisions in Games -Minmax Algorithm
• Game Tree: Game tree is graphical representation of the initial state and legal
moves for each side (two players – one by one) for a specific game
• MAX has nine possible move from initial state
• MAX with X and MIN with O symbol. The leaf nodes are entitled by utility
value
• The MAX is assumed with high values and MIN is with low values. The best
move is always determined by MAX by using search tree
• Optimal Strategies
• A sequence of moves which achieves Win state/ Terminal state/ Goal state in
search problem
• Optimal Strategy in Game
• It is techniques which always leads to superior that any other strategy as
opponent is playing in perfect manner
7
Game Playing
Optimal Decisions in Games -Minmax Algorithm
MINIMAX Procedure
• Starting from the leaves of the tree (with final scores with respect
to one player, MAX), and go backwards towards the root
• At each step, one player (MAX) takes the action that leads to the
highest score, while the other player (MIN) takes the action that
leads to the lowest score
• All nodes in the tree will be scored, and the path from root to the
actual result is the one on which all nodes have the same score
8
Game Tree
Example - 1
11/14/2022 9
Game Tree
Example - 1 Initial value of MAX
Initial value of Min
11/14/2022 10
Game Tree
11/14/2022 11
Game Tree
11/14/2022 12
Game Tree
11/14/2022 13
Solution
Game Tree ABDI
11/14/2022 14
Minimax algorithm
15
Game Tree
Example - 2
Game Tree
Solution
AB
Game Tree
Example - 3