Adversarial Search and Game Playing
Adversarial Search and Game Playing
A game tree is a tree where nodes of the tree are the game states and
Edges of the tree are the moves by players.
Game tree involves initial state, action function, and result Function.
GAME TREE:
In some games, the word “move” means that both players have taken
an action; therefore the word ply is used to unambiguously mean one
move by one player, bringing us one level deeper in the game tree.
MINIMAX ALGORITHM
MINIMAX ALGORITHM
Given a game tree, the optimal strategy can be determined by working out the
minimax value of each state in the tree, which we write as MINIMAX(s).
The minimax value is the utility (for MAX) of being in that state, assuming
that both players play optimally from there to the end of the game.
The minimax value of a terminal state is just its utility.
In a non terminal state, MAX prefers to move to a state of maximum value
when it is MAX’s turn to move, and MIN prefers a state of minimum value
(that is, minimum value for MAX and thus maximum value for MIN).
MINIMAX ALGORITHM
MINIMAX ALGORITHM
MINIMAX ALGORITHM
The minimax algorithm performs a complete depth-first exploration
of the game tree.
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.
If the maximum depth of the tree is m and there are b legal moves at
each point, then the time complexity of the minimax algorithm is
O(bm).
The space complexity is O(bm) for an algorithm that generates all
actions at once, or O(m)
MINIMAX ALGORITHM
MINIMAX ALGORITHM
Alpha–beta search updates the values of and as it goes along and prunes
the remaining branches at a node (i.e., terminates the recursive call) as
soon as the value of the current node is known to be worse than the
current or value for MAX or MIN, respectively.
ALPHA – BETA PRUNING ALGORITHM
Advantages:
•Faster Computation: Alpha-beta pruning skips unnecessary branches in the
game tree, making decision-making quicker than the standard minimax
algorithm.
•Deeper Search: It allows the algorithm to explore deeper into the game tree
without increasing the time taken, leading to better decision-making.
•Same Optimal Result: The algorithm still finds the best possible move, just
like minimax, but with fewer calculations.
•Works Well for Two-Player Games: It’s effective in games like chess, tic-tac-
toe, and checkers, where both players take turns and try to win.
ALPHA – BETA PRUNING ALGORITHM
Limitations:
Depends on Move Ordering: The algorithm works best if strong moves are evaluated
first. Poor move ordering means fewer branches will be pruned, reducing efficiency.
Not Suitable for All Games: Alpha-beta pruning isn’t helpful in games that involve
chance (like dice games) or incomplete information.
Still Exponential Growth: Even with pruning, game trees can grow very large in
complex games, making it difficult to manage deep searches.
Move Ordering is Challenging: Getting the right move order to maximize pruning is
difficult, and without it, the algorithm’s performance is limited.
ALPHA – BETA PRUNING ALGORITHM
IMPERFECT REAL TIME DECISIONS
ALPHA – BETA PRUNING ALGORITHM
Key Characteristics:
1.Hidden Information: Players do not have complete knowledge of the
game state. For example, in card games like Poker, players cannot see
opponents' cards.
2.Uncertainty: Decisions must be made based on guesses or inferences
rather than complete data.
3.Strategy and Bluffing: These games often require strategic thinking,
deduction, and bluffing.
PARTIALLY OBSERVABLE GAMES
Examples:
c. Strategic Challenges
Predicting the opponent’s belief state and possible responses.
Utilizing limited feedback to deduce the opponent’s piece positions.
Balancing exploration (gathering information) and exploitation
(executing winning strategies).
CARD GAMES: STOCHASTIC PARTIALLY OBSERVABLE
GAMES