0% found this document useful (0 votes)
37 views22 pages

DDAIS Adversarial Search

Uploaded by

deekshithavemuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views22 pages

DDAIS Adversarial Search

Uploaded by

deekshithavemuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

22AD2001A

DDAIS
Session -7

Contents: Adversarial Search


Adversarial Search

• Examine the problems that arise when we try to plan


ahead in a world where other agents are planning
against us.

• A good example is in board games.

• Adversarial games, while much studied in AI, are a small


part of game theory in economics.
Typical AI assumptions

• Two agents whose actions alternate

• Utility values for each agent are the opposite of the other
• creates the adversarial situation

• Fully observable environments

• In game theory terms: Zero-sum games of perfect


information.

• We’ll relax these assumptions later.


Search versus Games
• Search – no adversary
• Solution is (heuristic) method for finding goal
• Heuristic techniques can find optimal solution
• Evaluation function: estimate of cost from start to goal through given node
• Examples: path planning, scheduling activities

• Games – adversary
• Solution is strategy (strategy specifies move for every possible opponent reply).
• Optimality depends on opponent. Why?
• Time limits force an approximate solution
• Evaluation function: evaluate “goodness” of game position
• Examples: chess, checkers, Othello, backgammon
Types of Games

deterministic Chance moves


Perfect Chess, checkers, Backgammon,
information go, othello monopoly
Imperfect Bridge, Skat Poker, scrabble,
information blackjack
(Initial Chance
Moves)
Game Setup
• Two players: MAX and MIN

• MAX moves first and they take turns until the game is over
• Winner gets award, loser gets penalty.

• Games as search:
• Initial state: e.g. board configuration of chess
• Successor function: list of (move,state) pairs specifying legal moves.
• Terminal test: Is the game finished?
• Utility function: Gives numerical value of terminal states. E.g. win (+1), lose (-1) and draw (0) in tic-tac-
toe or chess
Size of search trees
• b = branching factor

• d = number of moves by both players

• Search tree is O(bd)

• Chess
• b ~ 35
• D ~100
- search tree is ~ 10 154 (!!)
- completely impractical to search this

• Game-playing emphasizes being able to make optimal decisions in a finite amount of time
• Somewhat realistic as a model of a real-world agent
• Even if games themselves are artificial
Partial Game Tree for Tic-Tac-Toe
Game tree (2-player, deterministic, turns)

How do we search this tree to find the optimal move?


Minimax strategy:
• Find the optimal strategy for MAX assuming an infallible MIN
opponent
– Need to compute this all the down the tree
– Game Tree Search Demo

• Assumption: Both players play optimally!


• Given a game tree, the optimal strategy can be determined by using
the minimax value of each node.
• Zermelo 1912.
Two-Ply Game Tree
Two-Ply Game Tree
Two-Ply Game Tree
Two-Ply Game Tree
Minimax maximizes the utility for the worst-case outcome for max

The minimax decision


Pseudocode for Minimax Algorithm

function MINIMAX-DECISION(state) returns an action


inputs: state, current state in game
vMAX-VALUE(state)
return the action in SUCCESSORS(state) with value v
function MAX-VALUE(state) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v  -∞
for a,s in SUCCESSORS(state) do
v  MAX(v,MIN-VALUE(s))
return v

function MIN-VALUE(state) returns a utility value

if TERMINAL-TEST(state) then return UTILITY(state)

v∞

for a,s in SUCCESSORS(state) do

v  MIN(v,MAX-VALUE(s))
Example-1
Cont…
Cont…
Example-2
Example-3
End of Session
Thank you

You might also like