AI-Chapter5Part1-Dr.Esraa
AI-Chapter5Part1-Dr.Esraa
AI-Chapter5Part1-Dr.Esraa
Intelligence
Adversarial Search
Dr. Esra’a Alshdaifat
In which we examine the problems that arise when we try
to plan ahead in a world where other agents are planning
against us.
GAMES
In multiagent environments, each agent needs to
consider the actions of other agents and how they
affect its own welfare.
In this chapter we cover competitive
environments, in which the agents’ goals are in
conflict, giving rise GAME to adversarial search
problems—often known as games.
GAMES
In AI, the most common games are of a rather
specialized kind—what game theorists call
deterministic, turn-taking, two-player, ZERO-SUM
GAMES of perfect information (such as chess).
In our terminology, this means deterministic, fully
observable environments in which two agents act
alternately and in which the utility values at the
end of the game are always equal and opposite. For
example, if one player wins a game of chess, the
other player necessarily loses. It is this opposition
between the agents’ utility functions that makes
the situation adversarial.
GAMES
A game can be formally defined as a kind of search
problem with the following elements:
S0: The initial state, which specifies how the game is set
up at the start.
PLAYER(s): Defines which player has the move in a state.
ACTIONS(s): Returns the set of legal moves in a state.
RESULT(s, a): The transition model, which defines the
result of a move.
TERMINAL-TEST(s): A terminal test, which is true when the
game is over and false otherwise. States where the game
has ended are called terminal states.
UTILITY(s, p): A utility function (also called an objective
function or payoff function), defines the final numeric
value for a game that ends in terminal state s for a player
p.
Utility Function
In chess, the outcome is a win, loss, or draw, with
values +1, 0, or ½ .
Some games have a wider variety of possible
outcomes; the payoffs in backgammon range from 0
to +192.
A zero-sum game is (confusingly) defined as one
where the total payoff to all players is the same for
every instance of the game. Chess is zero-sum
because every game has payoff of either 0 + 1, 1 + 0
or ½+ ½ .
Game Tree
game tree for the game—a tree where the nodes are
game states and the edges are moves.
Example: game tree for tic-tac-toe.
Play alternates between MAX’s placing an X and MIN’s
placing an O until we reach leaf nodes corresponding
to terminal states such that one player has three in a
row or all the squares are filled.
The number on each leaf node indicates the utility
value of the terminal state from the point of view of
MAX; high values are assumed to be good for MAX and
bad for MIN (which is how the players get their names).
For tic-tac-toe the game tree is relatively small—fewer
than 9! = 362, 880 terminal nodes.
A (partial) game tree for the
game of tic-tac-toe
MINIMAX Algorithm