Adversarial search with Game Playing

33
Adversarial Search By: Aman Patel Nileshwari Desai

description

Artificial Intelligence

Transcript of Adversarial search with Game Playing

Page 1: Adversarial search with Game Playing

Adversarial Search

By: Aman Patel

Nileshwari Desai

Page 2: Adversarial search with Game Playing

Topics Covered

• What is Adversarial Search ?

• Optimal decisions in Games

• Multiplayer Games

• Min-Max Algorithm

• α-β Pruning

• State of the Art Game Programs

Page 3: Adversarial search with Game Playing

What is Adversarial Search ?

• In computer science, a search algorithm is an algorithm for finding an item with specified properties among a collection of items. The items may be stored individually as records in a database; or may be elements of a search space defined by a mathematical formula or procedure.

• Adversarial search in Game playing :

“ In which we examine the problems that arise when we try to plan ahead in a world where other agents are planning against us”

Page 4: Adversarial search with Game Playing

MIN-MAX Algorithm

• MIN-MAX algorithm uses the optimal strategy to get to the desired goal state.

• Assuming that the opponent is rational and always optimizes its behaviour (opposite to us) we consider the best opponent’s response.

• MAX's strategy is affected by MIN's play. So MAX needs a strategy which is the best possible payoff, assuming optimal play on MIN's part.

• Then the MIN-MAX algorithm determines the best move.

• It is the perfect play for deterministic games.

Page 5: Adversarial search with Game Playing

Example

Page 6: Adversarial search with Game Playing
Page 7: Adversarial search with Game Playing
Page 8: Adversarial search with Game Playing
Page 9: Adversarial search with Game Playing
Page 10: Adversarial search with Game Playing
Page 11: Adversarial search with Game Playing
Page 12: Adversarial search with Game Playing
Page 13: Adversarial search with Game Playing
Page 14: Adversarial search with Game Playing

Why Minimax algorithm is bad ?

• The problem with minimax is that it is inefficient• Search to depth d in the game tree

• Suppose each node has at most b children

• Calculate the exact score at every node

• In worst case we search bd nodes – exponential

• However, many nodes are useless• There are some nodes where we don’t need to know exact score

because we will never take path in the future

Page 15: Adversarial search with Game Playing

Is there a good Min-Max ?

• Yes ! We just need to prune branches that are not required in searching

• Idea:• Start propagating scores as soon as leaf nodes are generated

• Do not explore nodes which cannot affect the choice of move

• The method for pruning the search tree generated by minimax is called Alpha-Beta

Page 16: Adversarial search with Game Playing

- values

• Computing alpha-beta values

• value is a lower-bound on the actual value of a Max node, maximum across seen children

• value is an upper-bound on actual value of a Min node, minimum across seen children

• Propagation

• Update , values by propagating upwards values of terminal nodes

• Update , values down to allow pruning

Page 17: Adversarial search with Game Playing

The - pruning

• Two key points:

• value can never decrease

• value can never increase

• Search can be discontinued at a node if:

o It is a Max node and

• ≥ , it is beta cutoff

o It is a Min node and

• ≤ , it is alpha cutoff

Page 18: Adversarial search with Game Playing

Example

Page 19: Adversarial search with Game Playing
Page 20: Adversarial search with Game Playing
Page 21: Adversarial search with Game Playing
Page 22: Adversarial search with Game Playing
Page 23: Adversarial search with Game Playing
Page 24: Adversarial search with Game Playing
Page 25: Adversarial search with Game Playing
Page 26: Adversarial search with Game Playing
Page 27: Adversarial search with Game Playing
Page 28: Adversarial search with Game Playing
Page 29: Adversarial search with Game Playing
Page 30: Adversarial search with Game Playing
Page 31: Adversarial search with Game Playing

State-of-the-art Game Programs

• Designing game-playing programs has a dual purpose: both to better understand how to choose actions in complex domains with uncertain outcomes and to develop high-performance systems for the particular game studied.

• In this section, we examine progress toward the latter goal.

Page 32: Adversarial search with Game Playing

Deterministic games in practice

• Checkers: Chinook ended 40-year-reign of human world champion Marion

Tinsley in 1994.

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.

• Chess: Deep Blue defeated human world champion Garry Kasparov in a

sixgame match in 1997.

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.

Page 33: Adversarial search with Game Playing

Deterministic games in practice

• Othello:

Human champions refuse to compete against computers, who are too good.

• Go: Human champions refuse to compete against computers, who are too bad.

In go, b > 300, so most programs use pattern knowledge bases to suggest

plausible moves.