Professional Documents
Culture Documents
AI05 05 Games
AI05 05 Games
Points
Games and strategies
A logic-based approach to games
AND-OR trees/graphs
Static evaluation functions
Tic-Tac-Toe
Minimax
Alpha-beta cutoff
Extensions
A_wins([5], B) A_wins([4], B)
A_wins([4], A) A_wins([3], A)
A_wins([3], B) A_wins([], B)
A_wins([], A)
Player B loses.
This is an AND/OR tree (actually a
directed, acyclic AND/OR graph).
A_wins([5], A) A_wins([4], A)
A_wins([4], B) A_wins([3], B)
A_wins([3], A) A_wins([], A)
A_wins([], B)
A_wins([8], A)
A_wins([7], B)
A_wins([4], B)
Assumptions:
only one of symmetrical positions is generated;
we build 2 levels of the game tree (one move --
one response) to have 2-ply lookahead.
xo x o x x x o o
o o x x
o x
6-5 5-5 6-5 5-5 4-5 5-4 6-4
o x x x x x
o o
o o
5-6 5-5 5-6 6-6 4-6
Player B chooses the minimal backed-up value among level 1 nodes.
Player A chooses the maximal value, and makes the move.
Player B, as a rational agent, selects the optimal response.
o x o x o o
x x x x x
x
o x o x o oo o o o
x x o x x x x xo
o o x x x
3-3 3-2 4-3 4-2 3-2 3-2
xo o o o
x x x x x
x x
x o o oo oo o o
x o x x x x xo x
o x x x xo
2-2 3-2 4-2 4-3 4-3 3-3
oo x oo oo oo oo
x x x x x x x
x x x x x x x
oo o ooo ooo oo o
x x x x x x
2-1 3-1 x x x x x x
2-1 3-1 - - - -
Building complete plies is usually not necessary. If we evaluate
a position when it is generated, we may save a lot.
Assume that we are at a minimizing level. If the evaluation
function returns -, we do not need to consider other positions:
- will be the minimum.
The same applies to + at a maximizing level.
x x
xo x o x x x o x
o o
o
6-5 5-5 6-5 5-5 4-5 5-6
xo x o x x x o x
o o
o
6-5 5-5 6-5 5-5 4-5 5-6
0 5 -3 3 3 -3 0 2 -2 3 5 2 5 -5 0 1 5 1 -3 0 -5 5 -3 3 2