adversarial search

39
Adversarial Search By: Aman Patel Nileshwari Desai

Upload: nilu-desai

Post on 27-Jun-2015

88 views

Category:

Entertainment & Humor


1 download

TRANSCRIPT

Page 1: Adversarial search

Adversarial Search

By: Aman Patel

Nileshwari Desai

Page 2: Adversarial search

Topics Covered

• What is Adversarial Search ?

• Applications in games

• Different types of games

• Optimal decisions in Games

• Multiplayer Games

• Min-Max Algorithm

• α-β Pruning

• State of the Art Game Programs

Page 3: Adversarial search

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

Assumptions & aims

• 2 agents whose actions alternate.

• Utility values for each agent are the opposite of the other which creates adversarial situations.

• Fully observable environments.

Page 5: Adversarial search

Applications in games

• Firstly, it should be a 2-player game.

• Players alternate the moves.

• Both should have perfect information.

• Using dice is not involved.

• Clear rules for legal moves.

• Well defined outcomes.

Page 6: Adversarial search

Different types of games

• Tic tac toe

• Checkers

• Chess

• Go

• Nim

• othello

Page 7: Adversarial search

How to strategize in each game?

• Consider all the legal moves you can make.

• Each move leads to a new board configuration.

• Evaluate each resulting position & determine which is best.

• Make that move.

• Wait for your opponent to move & repeat.

Page 8: Adversarial search

An example (partial) game tree for Tic-Tac-Toe

•f(n) = +1 if the position is a win for X.

•f(n) = -1 if the position is a win for O.

•f(n) = 0 if the position is a draw.

Page 9: Adversarial search

Game search problem

• Initial state– Board position and player

• Successor function– Returns a list of (action, state) pairs, indicating a legal move and

• Resulting state

• Terminal test– Determines when the game is over

• Utility function– Numeric value for a terminal state representing its utility for a

given player.

• In tic tac toe, the outcome is win, loss or draw with values +1, -1 or 0

Page 10: Adversarial search

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 11: Adversarial search

Example

Page 12: Adversarial search
Page 13: Adversarial search
Page 14: Adversarial search
Page 15: Adversarial search
Page 16: Adversarial search
Page 17: Adversarial search
Page 18: Adversarial search
Page 19: Adversarial search
Page 20: Adversarial search

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 21: Adversarial search

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 22: Adversarial search

- 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 23: Adversarial search

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 24: Adversarial search

Example

Page 25: Adversarial search
Page 26: Adversarial search
Page 27: Adversarial search
Page 28: Adversarial search
Page 29: Adversarial search
Page 30: Adversarial search
Page 31: Adversarial search
Page 32: Adversarial search
Page 33: Adversarial search
Page 34: Adversarial search
Page 35: Adversarial search
Page 36: Adversarial search
Page 37: Adversarial search

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 38: Adversarial search

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 39: Adversarial search

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.