1 / 7

180 likes | 818 Vues

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

**An Image/Link below is provided (as is) to download presentation**
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.
Content is provided to you AS IS for your information and personal use only.
Download presentation by click this link.
While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

**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 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**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.**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**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**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.**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