Amusement Playing.


55 views
Uploaded on:
Description
board setup: one of a kind game plan of
Transcripts
Slide 1

Diversion Playing Chapter 5 a few slides from UC-Irvine, CS Dept. ©2001 James D. Skrentny from notes by C. Dyer

Slide 2

Game Playing and AI Game playing (was?) thought to be a decent issue for AI research: diversion playing is non-unimportant players need "human-like" knowledge recreations can be exceptionally unpredictable (e.g., chess, go) requires basic leadership inside restricted time amusements normally are: all around characterized and repeatable constrained and available can straightforwardly analyze people and PCs ©2001 James D. Skrentny from notes by C. Dyer

Slide 3

Game Playing and AI ©2001 James D. Skrentny from notes by C. Dyer

Slide 4

Game Playing as Search Consider a two player prepackaged game: e.g., chess, checkers, tic-tac-toe board setup: one of a kind game plan of "pieces" Representing table games as hunt issue: states: board arrangements administrators: legitimate moves introductory state: ebb and flow board design objective state: winning/terminal board arrangement ©2001 James D. Skrentny from notes by C. Dyer

Slide 5

X O X O X O X O X O X O … Game Tree Representation What\'s the new angle to the pursuit issue? There\'s a rival we can\'t control! In what capacity would we be able to handle this? ©2001 James D. Skrentny from notes by C. Dyer

Slide 6

Complexity of Game Playing Assume the rival\'s moves can be anticipated given the PC\'s moves How complex would hunt be for this situation? thinking pessimistically: O(b d ) b farming component, d epth Tic-Tac-Toe: ~5 lawful moves, max of 9 moves 5 9 = 1,953,125 states Chess: ~35 lawful moves, ~100 moves per diversion b d ~ 35 100 ~10 154 states, "just" ~10 40 legitimate states Common recreations produce huge pursuit trees ©2001 James D. Skrentny from notes by C. Dyer

Slide 7

Greedy Search utilizing an Evaluation Function An assessment/utility capacity is utilized to delineate terminal condition of the board to a number comparing to the estimation of that state to the PC positive for winning negative for losing 0 for a draw average qualities (lost to win): -  to +  - 1.0 to +1.0 ©2001 James D. Skrentny from notes by C. Dyer

Slide 8

B - 5 C 9 D 2 E 3 B C D E F - 7 G - 5 H 3 I 9 J - 6 K 0 L 2 M 1 N 3 O 2 Greedy Search utilizing an Evaluation Function Expand the pursuit tree to the terminal states on every branch Evaluate utility of every terminal board design Make the underlying move that outcomes in the board arrangement with the greatest worth A 9 A PC\'s conceivable moves adversary\'s conceivable moves terminal states board assessment from PC\'s viewpoint ©2001 James D. Skrentny from notes by C. Dyer

Slide 9

B - 5 C 9 D 2 E 3 F - 7 G - 5 H 3 I 9 J - 6 K 0 L 2 M 1 N 3 O 2 Greedy Search utilizing an Evaluation Function Assuming a sensible pursuit space, what\'s the issue? This overlooks what the rival may do! PC picks C Opponent picks J and thrashings PC A 9 PC\'s conceivable moves rival\'s conceivable moves terminal states board assessment from PC\'s point of view ©2001 James D. Skrentny from notes by C. Dyer

Slide 10

Minimax Principle Assuming the most exceedingly awful (i.e., adversary plays ideally) : given there are two plays till the terminal states high utility numbers support the PC ought to pick augmenting moves low utility numbers support the rival keen rival picks minimizing moves ©2001 James D. Skrentny from notes by C. Dyer

Slide 11

B - 7 C - 6 D 0 E 1 B C D E F - 7 G - 5 H 3 I 9 J - 6 K 0 L 2 M 1 N 3 O 2 Minimax Principle The PC accept after it moves the adversary will pick the minimizing move The PC picks the best move considering both its turn and rival\'s ideal move A 1 A PC\'s conceivable moves rival\'s conceivable moves terminal states board assessment from PC\'s point of view ©2001 James D. Skrentny from notes by C. Dyer

Slide 12

Propagating Minimax Values up the Game Tree Explore the tree to the terminal states Evaluate utility of the subsequent load up arrangements The PC makes a move to put the load up in the best design for it accepting the adversary makes her best proceeds onward her turn: begin at the leaves relegate worth to the guardian hub as takes after use least when kids are rival\'s moves use greatest when youngsters are PC\'s moves ©2001 James D. Skrentny from notes by C. Dyer

Slide 13

B - 5 C 3 E - 7 F 4 J 9 K 5 M - 7 Deeper Game Trees Minimax can be summed up to more than 2 moves Propagate/permeate values upwards in the tree A 3 A PC max B C D 0 E oppponent min F G - 5 H 3 I 8 J K L 2 M PC max N 4 O - 5 O oppponent min P 9 Q - 6 R 0 S 3 T 5 U - 7 V - 9 terminal states W - 3 X - 5 ©2001 James D. Skrentny from notes by C. Dyer

Slide 14

General Minimax Algorithm For every move by the PC: Perform profundity first inquiry to a terminal state Evaluate every terminal state Propagate upwards the minimax values if rival\'s turn, engender up least estimation of kids if cumputer\'s turn, proliferate up most extreme estimation of kids pick move with the greatest of minimax estimations of kids Note: minimax values step by step spread upwards as DFS continues: i.e., minimax values engender up in "left-to-right" design minimax values for sub-tree engender upwards "as we go," so just O(bd) hubs should be kept in memory whenever ©2001 James D. Skrentny from notes by C. Dyer

Slide 15

Complexity of Minimax Algorithm Assume every single terminal state are at profundity d Space many-sided quality depth-first inquiry, so O(bd) Time multifaceted nature given fanning element b , so O(b d ) Time unpredictability is a noteworthy issue since PC normally just has a limited measure of time to make a move ©2001 James D. Skrentny from notes by C. Dyer

Slide 16

Complexity of Minimax Algorithm Direct Minimax calculation is unfeasible by and by rather do profundity constrained inquiry to profundity m however assessment characterized just for terminal states we have to know the estimation of non-terminal states Static board evaluator (SBE) capacities use heuristics to gauge the estimation of non-terminal states ©2001 James D. Skrentny from notes by C. Dyer

Slide 17

Static Board Evaluator (SBE) A static board assessment capacity is utilized to gauge how great the present board setup is for the PC it mirrors the PC\'s odds of winning from that hub it must be anything but difficult to ascertain from board arrangement For instance, Chess: SBE = α * materialBalance + β * centerControl + γ * … material parity = Value of white pieces - Value of dark pieces pawn = 1, rook = 5, ruler = 9, and so forth ©2001 James D. Skrentny from notes by C. Dyer

Slide 18

Static Board Evaluator (SBE) Typically, one subtracts how great it is for the PC from how great it is for the rival If the board assessment is X for a player then its - X for adversary Must concur with the utility capacity when figured at terminal hubs ©2001 James D. Skrentny from notes by C. Dyer

Slide 19

Minimax Algorithm with SBE int minimax (Node s, int profundity, int limit) { Vector v = new Vector(); if ( isTerminal (s) || profundity == limit)/base case return( staticEvaluation (s)); else {/do minimax on successors of s and recovery their qualities while (s.hasMoreSuccessors()) v.addElement( minimax (s.getNextSuccessor(),depth+1,limit)); if ( isComputersTurn (s)) return maxOf (v);/PC\'s turn return max of kids else return minOf (v);/adversary\'s turn return min of kids } ©2001 James D. Skrentny from notes by C. Dyer

Slide 20

Minimax with Evaluation Functions Same as general Minimax, aside from just goes to profundity m gauges utilizing SBE work How might this calculation perform at chess? on the off chance that could look ahead ~4 sets of moves (i.e., 8 handle) would be reliably beaten by normal players if could look ahead ~8 sets as done in an average PC, is comparable to human expert ©2001 James D. Skrentny from notes by C. Dyer

Slide 21

Summary So Far Can\'t Minimax hunt to the end of the amusement if could, then picking move is simple SBE isn\'t flawless at assessing/scoring in the event that it was, simply pick best move without looking Since nor is possible for intriguing diversions, consolidate Minimax with SBE: Minimax to profundity m use SBE to gauge/score board design ©2001 James D. Skrentny from notes by C. Dyer

Slide 22

Alpha-Beta Idea Some of the branches of the amusement tree won\'t be taken if playing against a wise rival Pruning can be utilized to disregard those branches Keep track of while doing DFS of diversion tree: amplifying level: alpha most noteworthy quality seen so far lower bound on hub\'s assessment/score minimizing level: beta least esteem seen so far higher bound on hub\'s assessment/score ©2001 James D. Skrentny from notes by C. Dyer

Slide 23

Alpha-Beta Idea Pruning happens: while boosting : if alpha  guardian\'s beta, quit growing opponent won\'t permit PC to take this course while minimizing : if beta  guardian\'s alpha, quit extending computer shouldn\'t take this course ©2001 James D. Skrentny from notes by C. Dyer

Slide 24

Alpha-Beta Example minimax(A,0,4) Call Stack max A α = An A B C D 0 E F G - 5 H 3 I 8 J K L 2 M N 4 O P 9 Q - 6 R 0 S 3 T 5 U - 7 V - 9 A W - 3 X - 5 ©2001 James D. Skrentny from notes by C. Dyer

Slide 25

Alpha-Beta Example minimax(B,1,4) Call Stack max A α = min B β = C D 0 E F G - 5 H 3 I 8 J K L 2 M N 4 O P 9 Q - 6 R 0 S 3 T 5 U - 7 V - 9 B A W - 3 X - 5 ©2001 James D. Skrentny from notes by C. Dyer

Slide 26

Alpha-Beta Example minimax(F,2,4) Call Stack max A α = B β = C D 0 E min max F α = F G - 5 H 3 I 8 J K L 2 M N 4 O P 9 Q - 6 R 0 S 3 T 5 U - 7 V - 9 F B A W - 3 X - 5 ©2001 James D. Skrentny from notes by C. Dyer

Slide 27

Alpha-Beta Example minimax(N,3,4) max Call Stack A α = min B β = C D 0 E max F α = G - 5 H 3 I 8 J K L 2 M N 4 N 4 O P 9 Q - 6 R 0 S 3 T 5 U - 7 V - 9 F B A W - 3 X - 5 blue: terminal state ©2001 James D. Skrentny from notes by C. Dyer .:tslide

Recommended
View more...