0% found this document useful (0 votes)
66 views

Module 4 Using Heuristic in Game Min-Max-Procedure

The document discusses using heuristics in games. It explains that games are an important application area for heuristic algorithms because games involve unpredictable opponents. It describes minimax search and alpha-beta pruning techniques for finding optimal moves in two-player games by searching the game tree. Minimax assigns MAX values to the player's nodes to maximize score and MIN values to opponent's nodes to minimize score. An example shows the exhaustive minimax search for a variant of the game Nim with 7 tokens.

Uploaded by

Dr Abdul Gafur M
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Module 4 Using Heuristic in Game Min-Max-Procedure

The document discusses using heuristics in games. It explains that games are an important application area for heuristic algorithms because games involve unpredictable opponents. It describes minimax search and alpha-beta pruning techniques for finding optimal moves in two-player games by searching the game tree. Minimax assigns MAX values to the player's nodes to maximize score and MIN values to opponent's nodes to minimize score. An example shows the exhaustive minimax search for a variant of the game Nim with 7 tokens.

Uploaded by

Dr Abdul Gafur M
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Using Heuristics in Games

1
Objectives

• Learn the basics of searching for two-person


games:
• minimax algorithm
• alpha-beta procedure.

2
What is in a “heuristic?”

f(n) = g(n) + h(n)

The estimated cost of


The heuristic value of
achieving the goal
node n
(from node n to the goal)

The actual cost of


node n
(from the root to n)

3
Game playing

 Games have always been an important application


area for heuristic algorithms. The games that we will
look at in this course will be two-person board games
such as nim, Tic-tac-toe, Chess
 Two person games are more complicated than simple
puzzles because of the existence of unpredictable
opponent.
 First we consider games whose state space is small
enough to be exhaustively searched. Here the
problem is systematically searching the space of
possible moves and counter moves by the opponent.
 Then we look at games in which it is either impossible
or undesirable to exhaustively search the game
graph. Because only a potion of the state space can
be generated and searched the game player must use
heuristics to guide play along a path to a winning
state. 4
A variant of the game nim

• A number of tokens are placed on a table


between the two opponents
• A move consists of dividing a pile of tokens
into two nonempty piles of different sizes
• For example, 6 tokens can be divided into
piles of 5 and 1 or 4 and 2, but not 3 and 3
• The first player who can no longer make a
move loses the game
• For a reasonable number of tokens, the
state space can be exhaustively searched

5
State space for a variant of nim with 7
tokens

6
Minimax Search Procedure

 The opponents in a game are referred


to as MIN and MAX.
 MAX represents the player trying to
win, or to MAXimize his/her
advantage.
 MIN is the opponent who attempts to
MINimize MAX’s score.

7 7
Minimax Search Procedure

The minimax algorithm is a way of


finding an optimal move in a two player
game.
Alpha-beta pruning is a way of finding
the optimal minimax solution while
avoiding searching subtrees of moves
which won't be selected.
In the search tree for a two-player game,
there are two kinds of nodes, nodes
representing your moves and nodes
representing your opponent's moves.
8 8
MAX Nodes

• Nodes representing your moves.


• These are also called MAX nodes.
• The goal at a MAX node is to maximize the
value of the subtree rooted at that node.
• To do this, a MAX node chooses the child
with the greatest value, and that becomes
the value of the MAX node.

9 9
MIN Nodes

• Nodes representing your opponent's moves


• These are also called MIN nodes.
• The goal at a MIN node is to minimize the
value of the subtree rooted at that node.
• To do this, a MIN node chooses the child
with the least (smallest) value, and that
becomes the value of the MIN node.

10 10
Exhaustive minimax for the game of nim

11

You might also like