CSC384: Intro To Artificial Intelligence Game Tree Search II Midterm: Everything Covered So Far Plus This Lecture Slides
CSC384: Intro To Artificial Intelligence Game Tree Search II Midterm: Everything Covered So Far Plus This Lecture Slides
CSC384: Intro To Artificial Intelligence Game Tree Search II Midterm: Everything Covered So Far Plus This Lecture Slides
Depth-first Implementation of
MinMax
Depth-first Implementation of
MinMax
utilityList([],[]).
utilityList([N|R],[U|UList])
:- utility(N,U), utilityList(R,UList).
utilityList
Visualization of DF-MinMax
s0
s1
t3
s13
s2
s6
t14
t4
s7
s10
t5
t8
t9
t11
s16
s17
t15
s18
t12
t19
t20
s24
s21
t25
t22
t23
t26
Pruning
It is not necessary to examine entire tree to
n:
s1
s2
s6
T4
10
min node
terminal
5
T3
8
s16
T5
5
=8 =10 =10
sequence of values for as s6s
children are explored
the children of n
Min
=8
14
12
s1
=2 4 9
s2
s3
At
s0
max node
s13
s1
=10
s2
=5
s16
min node
terminal
s6
=3
the children of n.
Max
alpha = 7
s1
n beta = 9
s2
8 3
s3
10
Alpha-Beta Algorithm
Pseudo-code that associates
a value with each node.
Strategy extracted by
moving to Max node (if you
are player Max) at each
step.
Evaluate(startNode):
/* assume Max moves first */
MaxEval(start, -infnty, +infnty)
11
Rational Opponents
This all assumes that your opponent is
rational
e.g.,
rationally?
will
12
Rational Opponents
Storing your strategy is a potential issue:
you must store decisions for each node you can
reach by playing optimally
if your opponent has unique rational choices, this
is a single branch through game tree
if there are ties, opponent could choose any one
of the tied moves: must store strategy for each
subtree
13
Practical Matters
All real games are too large to enumerate
tree
e.g.,
14
Practical Matters
We must limit depth of search tree
cant expand all the way to terminal nodes
we must make heuristic estimates about the
values of the (nonterminal) states at the leaves
of the tree
evaluation function is an often used term
evaluation functions are often learned
Depth-first expansion almost always used
15
Heuristics
Think of a few games and suggest some
checkers?
your
16
Schaeffer)
Chess (which you all know about)
Bridge, Poker, etc.
Check out Jonathan Schaeffers Web page:
www.cs.ualberta.ca/~games
theyve
17
18
19