Upload
vaibhav-makkar
View
220
Download
0
Embed Size (px)
Citation preview
7/30/2019 Game Tree
1/14
Game Tree
Chapter-3
7/30/2019 Game Tree
2/14
Game Tree
A finite game is a game in which every possible
combination of moves leads to an end of the game.
That is, it is impossible for the game to go on forever!
A game tree is a directed graph whose nodes are
positions in a game and whose edges are moves.
In a game tree, every node corresponds to a board
position. The children of each node N are thedifferent positions that result from a single move in
N, made by the player whose turn it is at N.
7/30/2019 Game Tree
3/14
7/30/2019 Game Tree
4/14
Game Trees
Problem spaces for typical games represented as trees.
Root node represents the board configuration at which
a decision must be made as to what is the best single
move to make next. (not necessarily the initial
configuration)
Evaluator function rates a board position. f(board) (a
real number).
Arcs represent the possible legal moves for a player (no
costs associates to arcs
Terminal nodes represent end-game configurations (the
result must be one of win, lose, and draw, possibly
with numerical payoff)
7/30/2019 Game Tree
5/14
7/30/2019 Game Tree
6/14
Game Tree
The root of the tree is the starting position, or the
position from which we want to find a move.
The leaves (nodes which have no children) in the
game tree correspond to terminating positions;
positions in which the game has ended.
A portion of the game tree for "Tic-tac-toe" is shown
in Figure. Note that each level in the tree pertains to the moves
made by one particular player.
7/30/2019 Game Tree
7/14
Importance
Game trees are important in artificial intelligence
because one way to pick the best move in a game is to
search the game tree using the minimax algorithm or
its variants.
7/30/2019 Game Tree
8/14
7/30/2019 Game Tree
9/14
7/30/2019 Game Tree
10/14
An example (partial) game tree for Tic-Tac-Toe
-
f(n) = +1 if the position is a
win for X.
f(n) = -1 if the position is a
win for O.
f(n) = 0 if the position is a
draw.
7/30/2019 Game Tree
11/14
Some Chess
Positions
and theirEvaluations
7/30/2019 Game Tree
12/14
Minimax Rule
Goal of game tree search: to determine one move for Max
player that maximizes the guaranteed payofffor a given
game tree for MAX
Regardless of the moves the MIN will take
The value of each node (Max and MIN) is determined by
(back up from) the values of its children
MAX plays the worst case scenario:
Always assume MIN to take moves to maximize his pay-
off (i.e., to minimize the pay-off of MAX)
For a MAX node, the backed up value is the maximum of
the values associated with its children
For a MIN node, the backed up value is the minimum of
the values associated with its children
7/30/2019 Game Tree
13/14
Game Tree
Each node represents a board position, and the children of eachnode are the legal moves from that position.
To score each position, we will give each position which isfavorable for player 1 a positive number (the more positive,the more favorable).
Similarly, we will give each position which is favorable forplayer 2 a negative number (the more negative, the morefavorable).
In our tic tac toe example, player 1 is 'X', player 2 is 'O', andthe only three scores we will have are +1 for a win by 'X', -1for a win by 'O', and 0 for a draw.
7/30/2019 Game Tree
14/14
A player can play perfect tic-tac-toe if they choose the move with thehighest priority in the following table[3].
1) Win: If you have two in a row, play the third to get three in a row.
2) Block: If the opponent has two in a row, play the third to blockthem.
3) Fork: Create an opportunity where you can win in two ways.
4) Block Opponent's Fork:
Option 1: Create two in a row to force the opponent into defending,as long as it doesn't result in them creating a fork or winning. Forexample, if "X" has a corner, "O" has the center, and "X" has theopposite corner as well, "O" must not play a corner in order to win.(Playing a corner in this scenario creates a fork for "X" to win.)
Option 2: If there is a configuration where the opponent can fork,block that fork.
5) Center: Play the center. 6) Opposite Corner: If the opponent is in the corner, play the
opposite corner.
7) Empty Corner: Play an empty corner.
8) Empty Side: Play an empty side.