Game Playing Introduc3on One of the earliest areas in - - PowerPoint PPT Presentation

game playing introduc3on
SMART_READER_LITE
LIVE PREVIEW

Game Playing Introduc3on One of the earliest areas in - - PowerPoint PPT Presentation

Game Playing Introduc3on One of the earliest areas in ar3ficial intelligence is game playing. Two-person zero-sum game. Games for which


slide-1
SLIDE 1

Game ¡Playing ¡

slide-2
SLIDE 2

Introduc3on ¡

  • One ¡of ¡the ¡earliest ¡areas ¡in ¡ar3ficial ¡

intelligence ¡is ¡game ¡playing. ¡ ¡

  • Two-­‑person ¡zero-­‑sum ¡game. ¡
  • Games ¡for ¡which ¡the ¡state ¡space ¡is ¡

small ¡enough ¡– ¡generate ¡the ¡en3re ¡

  • space. ¡
  • Games ¡for ¡which ¡the ¡en3re ¡space ¡

cannot ¡be ¡generated. ¡

slide-3
SLIDE 3

The ¡Game ¡NIM ¡

7 ¡ 6-­‑1 ¡ 5-­‑2 ¡ 4-­‑3 ¡ 5-­‑1-­‑1 ¡ 4-­‑2-­‑1 ¡ 3-­‑2-­‑2 ¡ 3-­‑3-­‑1 ¡ 4-­‑1-­‑1-­‑1 ¡ 3-­‑2-­‑1-­‑1 ¡ 2-­‑2-­‑2-­‑1 ¡ 3-­‑1-­‑1-­‑1 ¡ 2-­‑2-­‑1-­‑1 ¡ 2-­‑1-­‑1-­‑1-­‑1-­‑1 ¡

slide-4
SLIDE 4

NIM-­‑ ¡MAX ¡Plays ¡First ¡ ¡

. ¡

7 ¡ 6-­‑1 ¡ 5-­‑2 ¡ 4-­‑3 ¡ 5-­‑1-­‑1 ¡ 4-­‑2-­‑1 ¡ 3-­‑2-­‑2 ¡ 3-­‑3-­‑1 ¡ 4-­‑1-­‑1-­‑1 ¡ 3-­‑2-­‑1-­‑1 ¡ 2-­‑2-­‑2-­‑1 ¡ 3-­‑1-­‑1-­‑1 ¡ 2-­‑2-­‑1-­‑1 ¡ 2-­‑1-­‑1-­‑1-­‑1-­‑1 ¡ MAX ¡ MIN ¡ MAX ¡ MAX ¡ MIN ¡ MIN ¡ 1 ¡ 0 ¡ 1 ¡

slide-5
SLIDE 5

NIM-­‑ ¡MIN ¡Plays ¡First ¡ ¡

. ¡

7 ¡ 6-­‑1 ¡ 5-­‑2 ¡ 4-­‑3 ¡ 5-­‑1-­‑1 ¡ 4-­‑2-­‑1 ¡ 3-­‑2-­‑2 ¡ 3-­‑3-­‑1 ¡ 4-­‑1-­‑1-­‑1 ¡ 3-­‑2-­‑1-­‑1 ¡ 2-­‑2-­‑2-­‑1 ¡ 3-­‑1-­‑1-­‑1 ¡ 2-­‑2-­‑1-­‑1 ¡ 2-­‑1-­‑1-­‑1-­‑1-­‑1 ¡ MIN ¡ MAX ¡ MIN ¡ MIN ¡ MAX ¡ MAX ¡ 0 ¡ 1 ¡ 0 ¡

slide-6
SLIDE 6

Minimax ¡Algorithm ¡

Repeat ¡

  • If ¡the ¡limit ¡of ¡search ¡has ¡been ¡reached, ¡compute ¡the ¡

sta3c ¡value ¡of ¡the ¡current ¡posi3on ¡rela3ve ¡to ¡the ¡ appropriate ¡player. ¡ ¡Report ¡the ¡result. ¡

  • Otherwise, ¡if ¡the ¡level ¡is ¡a ¡minimizing ¡level, ¡use ¡the ¡

minimax ¡on ¡the ¡children ¡of ¡the ¡current ¡posi3on. ¡ ¡ Report ¡the ¡minimum ¡value ¡of ¡the ¡results. ¡

  • Otherwise, ¡if ¡the ¡level ¡is ¡a ¡maximizing ¡level, ¡use ¡the ¡

minimax ¡on ¡the ¡children ¡of ¡the ¡current ¡posi3on. ¡ ¡ Report ¡the ¡maximum ¡of ¡the ¡results. ¡ Un3l ¡the ¡en3re ¡tree ¡is ¡traversed ¡

. ¡

slide-7
SLIDE 7

Minimax ¡Applied ¡to ¡NIM ¡

. ¡

7 ¡ 6-­‑1 ¡ 5-­‑2 ¡ 4-­‑3 ¡ 5-­‑1-­‑1 ¡ 4-­‑2-­‑1 ¡ 3-­‑2-­‑2 ¡ 3-­‑3-­‑1 ¡ 4-­‑1-­‑1-­‑1 ¡ 3-­‑2-­‑1-­‑1 ¡ 2-­‑2-­‑2-­‑1 ¡ 3-­‑1-­‑1-­‑1 ¡ 2-­‑2-­‑1-­‑1 ¡ 2-­‑1-­‑1-­‑1-­‑1-­‑1 ¡ MIN ¡ MAX ¡ MIN ¡ MIN ¡ MAX ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 1 ¡ MAX ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡ 1 ¡ 1 ¡ 1 ¡

slide-8
SLIDE 8

Genera3ng ¡the ¡Game ¡Tree ¡to ¡a ¡ Depth ¡

  • In ¡some ¡cases ¡the ¡game ¡tree ¡will ¡be ¡

too ¡large ¡to ¡generate. ¡

  • In ¡this ¡case ¡the ¡tree ¡is ¡generated ¡to ¡

a ¡certain ¡depth ¡or ¡ply. ¡

  • Heuris3c ¡values ¡are ¡used ¡to ¡es3mate ¡

how ¡promising ¡a ¡node ¡is. ¡

  • Horizon ¡effect ¡

¡

. ¡

slide-9
SLIDE 9

Example ¡

3 3 2 3 9 7 2 6 2 3 5 9 7 4 2 1 5 6 MAX MIN MAX MIN

slide-10
SLIDE 10

Heuris3c ¡for ¡Tic-­‑Tac-­‑Toe ¡

  • h(n) ¡= ¡x(n) ¡-­‑ ¡o(n) ¡where ¡ ¡

– x(n) ¡is ¡the ¡total ¡of ¡MAX’s ¡possible ¡ winning ¡lines ¡(we ¡assume ¡MAX ¡is ¡ playing ¡x) ¡ ¡ ¡ – o(n) ¡is ¡the ¡total ¡of ¡MIN’s ¡possible ¡ winning ¡lines ¡ ¡

  • h(n) ¡is ¡the ¡total ¡evalua3on ¡for ¡a ¡state ¡
  • n. ¡ ¡ ¡