1 / 7

# Game Trees

Kat Powell Daniel Christopher Igor Polyakov CS 134 Spring 2007. Game Trees. Each vertex (or node) represents a game state (point of choice for a player) Children of each node are positions that are reached by one move

Télécharger la présentation

## Game Trees

E N D

### Presentation Transcript

1. Kat Powell Daniel Christopher Igor Polyakov CS 134 Spring 2007 Game Trees

2. Each vertex (or node) represents a game state (point of choice for a player) Children of each node are positions that are reached by one move Computer evaluates each possible move along all paths as far as it can or wants to into the future from the current game position Uses minimax algorithm for maximizing the minimum gain or minimizing the maximum possible loss (i.e., Zero-Sum Game) Definition

3. Zero-Sum Game • Choices by players can neither increase nor decrease the available resources • Total benefit to all players in the game, for every combination of strategies, always adds to zero • In other words, one player benefits only at the expense of the other player (minimax algorithm) • Minimax expensive algorithm Examples: checkers, chess, tic-tac-toe, Nim • Nim is a two-player mathematicalgame of strategy in which players take turns removing objects from distinct heaps. Variants of Nim have been played since ancient times. The player to take the last object loses.

4. Negamax • Less expensive variation on the Minimax algorithm • The value of a position to player A in such a game is the negation of the value to player B • Current player looks for move that maximizes the negation of the value of the position resulting from the move • This successor position must by definition have been valued by the opponent • A single computation can be used to value all positions thus simplifying the code

5. Alpha-beta pruning • Search algorithm that reduces the number of nodes that need to be evaluated in the game tree by the minimax or negamax algorithm • It stops completely evaluating a move that a player can make when at least one reply has been found that proves the move to be worse than a previously examined move • Since it clearly does not benefit the player to play that move, it need not be evaluated any further. • Saves processing time

6. Depth-limited negamax search with alpha-beta pruningmost efficient game tree algorithm function negamax(node, depth, α, β){ if node is a terminal node or depth = 0{ return the heuristic value of node } else{ foreach (child of node){ α := max(α, -negamax(child, depth-1, -β, -α)) #start alpha-beta pruning if (α ≥ β){ return β } } return α The arguments α and β should be set to the lowest and highest values possible for any node respectively.

7. Extensive Form Game Tree • Player 1 moves first and selects either F or U • Player 2 selects either A or R • The payoffs are specified at the bottom of the tree • So, if Player 1 selects U and Player 2 selects A, then Player 1 gets 8 and Player 2 gets 2

More Related