Artificial Inteligence
Artificial Inteligence
-Branching factor: 35 -Depth: 50 moves each player -Search tree: 35100 nodes (~1040 legal positions) Despite this, human players do quite well without doing
much explicit search. They seem to rely on remembering many patterns.
...
...
...
...
Minimax Algorithm General method for determining optimal move. Generate complete game tree down to terminal states. Compute utility of each node bottom up from leaves toward root. At each MAX node, pick the move with maximum utility. At each MIN node, pick the move with minimum utility
(assumes opponent always acts correctly to minimize utility).
MAX
Minimax Computation
3
A1
MIN
A 11 A 12
A2
2
A 21 A 22 A 23
A3
2
A 31 A 32 A 33
3
A 13
12
14
Imperfect Decisions Generating the complete game tree for all but the simplest
games is intractable.
Determining Cutoff Search to a uniform depth (ply) d. Use iterative deepening to continue search to deeper levels
Could end in states that are very dynamic (not quiesent) in Ideally, a heuristic measures the probability that MAX will
win given a position characterized by a given set of features. which evaluation could change quickly, as in (d) below.
Alpha-Beta Pruning
No need to explore options that are already denitely worse Example: Delay inevitable queening move by pawn by
exploring checking moves.
MAX
3
A1
MIN
A 11 A 12
A2
<=2
A 21 A 22 A 23
A3
2
A 31 A 32 A 33
3
A 13
12
14
Black to move
10
Alpha-Beta Algorithm
function MAX-VALUE(state, game, , ) returns the minimax value of state inputs: state, current state in game game, game description , the best score for MAX along the path to state , the best score for MIN along the path to state if CUTOFF-TEST(state) then return EVAL(state) for each s in SUCCESSORS(state) do MAX( , MIN-VALUE(s, game, , )) if then return end return function MIN-VALUE(state, game, , ) returns the minimax value of state if CUTOFF-TEST(state) then return EVAL(state) for each s in SUCCESSORS(state) do MIN( , MAX-VALUE(s, game, , )) then return if end return
Player
11
12
State of the Art Game Programs Chess: DeepBlue beat world champion -Customized parallel hardware -Highly-tuned evaluation function developed with expert -Comprehensive opening and end-game databases Checkers: -Samuels learning program eventually beat developer. -Chinook is world champion, previous champ held title for
40 years had to withdraw for health reasons.
time complexity reduces from O(bd) to O(bd/2), a dramatic improvement. But entails knowledge of best move in advance!
Othello: Programs best players (e.g. Iago). Fairly simple ordering heuristic can produce closer to
optimal results than random results (e.g. check captures & threats rst).
13
17