Вы находитесь на странице: 1из 3

A is a directed graph whose nodes are positions in a game and whose edges are moves.

The complete game tree for a game is the game tree starting at the initial position and containing all possible moves from each position; the complete tree is the same tree as that obtained from the extensive-form game representation.

game tree

A peep out of the class.....


In REAL WORLD Chess play was considered a tough challenge to crack. Initially, there was doubt whether a computer would ever be able to beat a top human player. The feeling was that intuition, originality and expertise that humans possessed would never be matched by computers. In 1968 a Chess master named David Levy made a famous bet that no computer program will be able to beat him in the next 10 years. He won the bet in 1978 when he defeated Chess 4.7 one of the top programs of that time, but commented that soon computers would defeat even the best human players. In 1997, Deep Blue defeats the human world champion Garry Kasparov in a public match that to many symbolizes the end of the era of human supremacy in Chess. While Deep Blue used special hardware to evaluate moves and was in fact a super-computer, Modern computer players regularly beat grand-master level players using in-expensive hardware (personal computers that are now present at every home). The increase in performance is due to the exponential increase in speed of modern hardware, as well as the use of more sophisticated game playing algorithms. All current top programs that play Chess employ extensive search in the game tree, and so demonstrate that human intuition and originality can actually be countered by brute force search using a fast enough machine.

Coming back to AI...


Game trees are important in artificial intelligence because one of the ways to pick the best move in a game is to search a game tree using the minimax algorithm or its variants. The game tree for tic-tac-toe is easily searchable, but the complete game trees for larger games like chess are much too large to search. Instead, a chess-playing program searches a partial game tree: typically as many plies from the current position as it can search in the time available. To simplify things a bit, we will only consider games with the following two properties: Two players Zero sum - one player's win is the other's loss; there are no cooperative victories Examples of these kinds of games include many classic board games, such as tic tac toe, chess, checkers, and go. For these types of games, we can model the game using a game tree:

Algorithm for computing the best move is the minimax algorithm:


minimax(player,board) if(game over in current board position) return winner children = all legal moves for player from this board if(max's turn)
return maximal score of calling minimax on all the children

else if(min's turn)


return minimal score of calling minimax on all the children

ISSUES & SOLUTIONS

For a simple game like tic tac toe - it is certainly possible to search all possible positions. For a game like Chess or Go however, the running time is prohibitively expensive. The number of states and as a result the size of the state space tree(search tree) is also huge. So we go for pruning(chopping/cutting) the tree. To formalize this idea, we will keep track of two numbers, alpha and beta for each node we're analyzing, hence the name for this algorithm alpha-beta pruning. Alpha will be the value of the best possible move you can make, that you have computed so far. Beta will be the value of the best possible move your opponent can make, that you have computed so far. If at any time, alpha >= beta, then your opponent's best move can force a worse position than your best move so far, and so there is no need to further evaluate this move. The same pruning condition applies if you are the min player, except instead of finding the move that yields alpha, you would find the move that yields beta. To guarantee that this algorithm returns a move, we can start alpha with -infinity (the best you can do is lose) and beta with infinity (the worst your opponent can do is to let you win), and update these values as we examine more nodes.

ALGORITHM:

alpha-beta(player,board,alpha,beta)
if(game over in current board position) return winner children = all legal moves for player from this board

if(max's turn) for each child score = alpha-beta(other player,child,alpha,beta) if score > alpha then alpha = score (we have found a better best move) if alpha >= beta then return alpha (cut off) return alpha (this is our best move) else (min's turn) for each child score = alpha-beta(other player,child,alpha,beta) if score < beta then beta = score (opponent has found a better worse move) if alpha >= beta then return beta (cut off) return beta (this is the opponent's best move)

Notice that it is to our advantage to generate the best moves first for max and the worst moves first for min; this will cause the algorithm to cut off more quickly. On average, using a good successor generator will allow alpha-beta to search to a level twice as deep as minimax in the same amount of time. Note also that alpha-beta returns the same score as minimax; it simply returns the same result in faster time. Artificial Intelligence. Study Material.
Prepared by: Jabez Christopher, Asst. Professor, SCSE.

Вам также может понравиться