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

CS632 Lecture 09

The document discusses game trees and their application in artificial intelligence for competitive environments, focusing on adversarial search problems. It explains concepts such as the minimax algorithm, alpha-beta pruning, and the challenges posed by games of chance. Additionally, it highlights notable AI achievements in games like checkers, chess, and Go.

Uploaded by

mesaad074
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)
8 views22 pages

CS632 Lecture 09

The document discusses game trees and their application in artificial intelligence for competitive environments, focusing on adversarial search problems. It explains concepts such as the minimax algorithm, alpha-beta pruning, and the challenges posed by games of chance. Additionally, it highlights notable AI achievements in games like checkers, chess, and Go.

Uploaded by

mesaad074
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

ARTIFICIAL

INTELLIGENCE

GAME TREES

CS-632

Dr. Ghulam Mustafa

University Institute of Information Technology


PMAS-Arid Agriculture University Rawalpindi
GAMES

• Competitive environments, in which the agents’


goals are in conflict, giving rise to adversarial search
problems—often known as games.

• Mathematical game theory, a branch of economics,


views any multiagent environment as a game,
provided that the impact of each agent on the others
is “significant,” regardless of whether the agents are
cooperative or competitive.
KINDS OF GAMES

• Deterministic
• Turn-taking
• 2-player
• Zero-sum
• Perfect information

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.
GAME AS SEARCH PROBLEM
• Initial State: board position and player to move
• Successor Function: returns a list of legal (move,
state) pairs
• Terminal Test: determines when the game is over
• Utility function: Gives a numeric value for the
terminal state
GAME TREES
• Game trees are used to represent two-player
games.
• Alternate moves in the game are represented by
alternate levels in the tree.
• Nodes in the tree represent positions.
• Edges between nodes represent moves.
• Leaf nodes represent won, lost or drawn positions.
GAME TREES

This is an example of a
partial game tree for the
game tic-tac-toe.
Even for this simple game,
the game tree is very large.
ASSUMPTIONS
• In talking about game playing systems, we make a
number of assumptions:
• The opponent is rational – will play to win.
• The game is zero-sum – if one player wins, the other loses.
• Usually, the two players have complete knowledge of the
game. For games such as poker, this is clearly not true.
MINIMAX

• Minimax is a method used to evaluate game trees.


• A static evaluator is applied to leaf nodes, and
values are passed back up the tree to determine
the best score the computer can obtain against a
rational opponent.
MINIMAX – ANIMATED
EXAMPLE

Max 3 6 The computer can


obtain 6 by
choosing the right
Min 6 hand edge from the
5 3 first node.

Max 1 3 6 0 7
5

5 2 1 3 6 2 0 7
MINIMAX FUNCTION

• MINIMAX-VALUE(n) =
• UTILITY(n)
if n is a terminal state
• maxs  Successors(n) MINIMAX-VALUE(s)
if n is a MAX node
• mins  Successors(n) MINIMAX-VALUE(s)
if n is a MIN node
SEARCHING GAME TREES

• Exhaustively searching a game tree is not


usually a good idea.
• Even for a game as simple as tic-tac-toe there
are over 350,000 nodes in the complete game
tree.
• An additional problem is that the computer only
gets to choose every other path through the
tree – the opponent chooses the others.
ALPHA-BETA PRUNING

• A method that can often cut off a half the game


tree.
• Based on the idea that if a move is clearly bad,
there is no need to follow the consequences of it.
• alpha – highest value we have found so far
• beta – lowest value we have found so far
ALPHA-BETA PRUNING (CONT.)

• In Minimax search algorithm, the number of game states are


exponential in depth of the tree.
• We cannot eliminate the exponent, but we can cut it to half.
• Hence pruning is a technique by which without checking each
node of the game tree we can compute the correct minimax
decision.
• This involves two threshold parameter, Alpha and Beta for
future expansion.
• So, it is called alpha-beta pruning or Alpha-Beta Algorithm.
ALPHA-BETA PRUNING (CONT.)

• Alpha: The best (highest-value) choice we have found so far at


any point along the path of Maximizer. The initial value of alpha
is -∞.
• Beta: The best (lowest-value) choice we have found so far at
any point along the path of Minimizer. The initial value of beta
is +∞.
The Alpha-beta pruning to a standard minimax algorithm returns
the same move as the standard algorithm does, but it removes all
the nodes which are not really affecting the final decision but
making algorithm slow. Hence by pruning these nodes, it makes
the algorithm fast.
ALPHA-BETA PRUNING (CONT.)

• The main condition which required for alpha-beta


pruning is: α>=β
• The Max player will only update the value of alpha.
• The Min player will only update the value of beta.
• While backtracking the tree, the node values will be
passed to upper nodes instead of values of alpha and
beta.
• We will only pass the alpha, beta values to the child
nodes.
ALPHA-BETA PRUNING (CONT.)

https://www.javatpoint.com/ai-alpha-beta-pruning
ALPHA-BETA PRUNING –
EXAMPLE.
max 3 • In this tree, having
examined the nodes with
values 7 and 1 there is
no need to examine the
min final node.
CHECKERS

• In 1959, Arthur Samuel creates a computer


program that could play checkers to a high level
using minimax and alpha-beta pruning.
• Chinook, developed in Canada defeated the world
champion:
• Uses alpha-beta pruning.
• Has a database of millions of end games.
• Also has a database of openings.
• Uses heuristics and knowledge about the game.
CHESS

• In 1997, Deep Blue defeated world champion,


Garry Kasparov.
• This has not yet been repeated.
• Current systems use parallel search, alpha-
beta pruning, databases of openings and
heuristics.
• The deeper in a search tree the computer can
search, the better it plays.
GO

• Go is a complex game played on a 19x19


board.
• Average branching factor in search tree
around 360 (compared to 38 for chess).
• The best computer programs cannot
compete yet with the best human players.
• Methods use pattern matching or selective
search to explore the most appropriate
parts of the search tree.
GAMES OF CHANCE
• The methods described so far do not work well with
games of chance such as poker or backgammon.
• Expectiminimax is a variant of minimax designed to
deal with chance.
• Nodes have expected values based on
probabilities.
Thank You

You might also like