Week15 16 PDF
Week15 16 PDF
Intelligence
Dr.
Qaiser
Abbas
Department
of
Computer
Science
&
IT,
University
of
Sargodha,
Sargodha,
40100,
Pakistan
[email protected]
• Expand
each
of
these
new
possible
moves
for
the
other
player.
• Con^nue
this
expansion
un^l
a
winning
posi^on
for
the
player
is
found.
Saturday
16
May
20
6
Simple
Approach
in
Tic-‐Tac-‐Toe
– This
algorithm
will
work
and
locate
a
series
of
winning
moves
at
the
cost
of
enormous
calcula^on
e.g.
one
board
at
first,
9
at
the
next
level,
9∗8
next
and
so
on.
In
total:
– This
is
not
so
big
that
we
cannot
calculate
it,
but
it
is
alarming
since
Noughts
and
Crosses
is
such
a
simple
game.
Saturday
16
May
20
7
OPTIMAL
DECISIONS
IN
GAMES
• An
op^mal
strategy
leads
to
outcomes
at
least
as
good
as
any
other
strategy
when
one
is
playing
an
infallible
opponent.
• Two
Player
Games:
– Consider
a
Zero-‐Sum
game
in
which
gain
of
one
player
is
balanced
exactly
by
the
loss
of
other
player.
– Sta^c
Evalua^on
Func^on
f(n)
=
Complete
R/C/D
open
posi^ons
for
X
–
Complete
R/C/D
open
posi^ons
for
O
– This
f(n)
is
useful
but
another
heuris^cs
is
necessary
to
pick
the
move
with
highest
f(n)
while
protec^ng
against
a
loss
in
the
next
move.
– For
this
purpose,
a
Minimax
algorithm
given
next,
in
which
the
algorithm's
opponent
will
be
trying
to
minimize
whatever
value
the
algorithm
is
trying
to
maximize
(hence,
”Minimax").
– Thus,
the
computer
should
make
the
move
which
leaves
its
opponent
capable
of
doing
the
least
damage.
• Can
pursue
the
tree
by
making
guesses
as
to
how
the
opponent
will
play.
• Suppose
they
have
values
x
and
y.
Then
the
value
of
the
root
is:
– MINIMAX(root)
=
Max(Min(3,12,8),Min(2,x,y),Min(14,5,2))
=
Max(3,Min(2,x,y),2)
=
Max(3,z,2)
where
z
=
Min(2,x,y)
≤
2
=
3.
• Alpha–beta
pruning
can
be
applied
to
trees
of
any
depth,
and
it
is
oOen
possible
to
prune
en^re
subtrees
rather
than
just
leaves.
– α
=
the
value
of
the
best
(i.e.,
highest-‐value)
choice
we
have
found
so
far
at
any
choice
point
along
the
path
for
MAX.
– β
=
the
value
of
the
best
(i.e.,
lowest-‐value)
choice
we
have
found
so
far
at
any
choice
point
along
the
path
for
MIN.