Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence

Similar presentations


Presentation on theme: "Artificial Intelligence"— Presentation transcript:

1 Artificial Intelligence
Game Playing Chapter 6

2 Outline of this Chapter
Introduction Defining a game 2 person games Minimax α-β pruning State of the art Game programs

3 Introduction Game playing is one of the oldest area in AI.
In 1950, the first chess programs were written by C.Shannon & A.Turing. IBM's Deep Blue Supercomputer defeats the chess grandmaster Kasparov in 1997 Last weeks, we looked at: search problems where the situation is not going to change (e.g., if we are searching for a route between two towns, the towns do not move during the search). In game playing. If we make a move in Board Games such as chess then our opponent is going to move next, so we cannot be certain what the board state will be after our opponents moves. Not all games are suitable for AI research. We will restrict ourselves to 2 person perfect information board games.

4 Definition Playing a game involves searching for the best move.
Game can be defined as a type of search problem with the following components: Players: We call them Max and Min. Initial state- how the board is set up Operators- define legal moves that a player can make Terminal state- when the game is over Utility/payoff function- A function which assigns a numeric value for the outcome of a game (e.g. in chess the outcome is win (+1), lose (-1) or draw (0). Note that by convention, we always measure utility relative to Max. Two strategies have been defined: Minimax algorithm (by John von Neumann in 1944) Alpha-Beta algorithm

5 Two-Person Games Two-player games with perfect information (player knows everything about the possible moves of the adversary), the minimax can determine the best move for a player by enumerating the entire game tree. Player 1 is called Max Maximizes result Player 2 is called Min Minimizes opponent’s result

6 A Search Tree for Noughts and Crosses Game
MAX’s job to use the search tree to determine the best move. Simple game – too complex to show/draw the whole search tree.

7 Minimax Steps Minimax examines the entire generated game tree, and picks the best path that can be forced. The minimax algorithm consists of 5 steps Generate the whole game tree. 2. Apply the utility function to leaf nodes to get their values. 3. Use the utility of nodes at level n to determine the utility of nodes at level n-1 in the search tree. 4. Continue backing up values towards the root, one layer at a time. 5. Eventually the backed up values reach the top of the tree, at that point Max chooses the move that leads to the highest value. This is called the minimax decision because it maximises the utility under the assumption that Min will play perfectly to minimise it.

8 Minimax (2-ply game) Perfect play for deterministic games, perfect-information games Terminal nodes show the utility value for MAX computed by the utility function (i.e. by the rules of the game). Other nodes labeled with their minimax values MAX prefers to move to a state of maximum value MIN prefers a state of minimum value The values have been propagated back up through the tree based on whose turn it is to play and whether they are trying to maximise or minimise.

9 Properties of minimax (d= depth of the tree, b=legal moves)
It is Complete (if tree is finite) It is Optimal (against an optimal opponent) Time Complexity: bd Space Complexity: b*d (d= depth of the tree, b=legal moves) Complexity: many games have a huge search space For chess: b = 35 legal moves in any given position, d=100 for "reasonable" games  nodes = positions are searched Do we need to explore every path?

10 The Need for Imperfect Decision
Problem: The problem with minimax is that we expand every node down to a certain depth even though, in certain cases we are wasting our timenot practical for games of any size game-playing programs must meet external time-constraints. we cannot calculate the entire game tree in order to find out the terminal values so that we can propagate them back up through the tree.

11 The Need for Imperfect Decision (cont.)
Solution: Instead of going all the way to terminal states & using utility function. Cut off search earlier and apply a heuristic evaluation function to the leaves of the tree. Note In search problems where we are searching for a goal our heuristic value represents an estimate as to how close we are to the goal. In game playing we are estimating the chances of winning from a given position.

12 α-β pruning A technique that enables the Minimax algorithm to ignore branches that will not contribute further to the outcome of the search. The process of eliminating a branch of the search tree is called pruning the search tree. Alpha-beta pruning uses a depth first search. In doing so it maintains two variables α and β (α is associated with MAX can never decrease and β is associated with MIN can never increase). when applied to standard minimax tree, it returns the same move as minimax would but prunes away branches that cannot possibly influence the final decision.

13 α-β pruning example

14 α-β pruning example

15 α-β pruning example

16 α-β pruning example

17 α-β pruning example

18 State of the Art in Chess
Chess has received by far the largest share of attention in game playing. 1957: Herbert Simon predicted that within 10 years computers would beat the human world champion. In 1958, the first computer able to play chess was an IBM 704. 1970: First program to win ACM North American Computer Chess Championship, it uses straightforward alpha-beta search, augmented with book openings and infallible end game algorithms. 1982: Belle, first special-purpose chess hardware, built by Condon & Thompson at Bell Labs , can search few million of position per move.

19 State of the Art in Chess (Cont.)
1985: HITECH system can search 10 million of position per move , ranked among the top 800 human players around the world. 1993: Deep Thought 2, ranked top 100 human players, can search 500 million of position per move, reaching a depth of 11. 1997: Deep Blue defeated human world champion Garry Kasparov in a six-game match in Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply.

20 State of the Art in Checkers
1952: Arthur Samuel developed a checkers program that learn its own evaluation function through self play. 1992: Chinook (J. Schaeffer) wins the U.S. Open. At the world championship, Alpha-beta search were used, but Marion Tinsley beat Chinook. 1994:Chinook ended 40-year-reign of human world champion Marion Tinsley. Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions.-- Chinook become the world champion.

21 State of the Art in Go Go is the most popular board game in Asia.
Aim By placing the stones on the board, each player tries to win the game by surrounding unoccupied territory as well as enemy stones. Surround more than your opponent and you win! The branching factor approaches 360, infeasible for regular search methods. Go seems like an area likely to benefit from intensive research using sophisticated reasoning methods. Most programs use pattern knowledge bases to suggest plausible moves.

22 Summary Games are fun to work on
They illustrate several important points about AI perfection is unattainable  must approximate with perfect information, the minimax can determine the best move for a player by enumerating the entire game tree. The α-β algorithm does the same calculation as minimax, but is more efficient – prunes away irrelevant branches of the search tree

23 End of Chapter 6


Download ppt "Artificial Intelligence"

Similar presentations


Ads by Google