Game-playing AIs Part 1 CIS 391 Fall 2007. CSE 391 - Intro to AI 2 Games: Outline of Unit Part I (this set of slides)  Motivation  Game Trees  Evaluation.

Slides:



Advertisements
Similar presentations
Game Playing CS 63 Chapter 6
Advertisements

Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
CMSC 671 Fall 2001 Class #8 – Thursday, September 27.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
Adversarial Search: Game Playing Reading: Chapter next time.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Hoe schaakt een computer? Arnold Meijster. Why study games? Fun Historically major subject in AI Interesting subject of study because they are hard Games.
Adversarial Search Chapter 6.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
CMSC 463 Chapter 5: Game Playing Prof. Adam Anthony.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
Game-Playing Read Chapter 6 Adversarial Search. Game Types Two-person games vs multi-person –chess vs monopoly Perfect Information vs Imperfect –checkers.
Adversarial Search: Game Playing Reading: Chess paper.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
CSC 412: AI Adversarial Search
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
Adversarial Search Chapter 5 Adapted from Tom Lenaerts’ lecture notes.
Lecture 5CSE Intro to Cognitive Science1 Algorithmic Thinking III.
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Game Playing. Introduction Why is game playing so interesting from an AI point of view? –Game Playing is harder then common searching The search space.
Adversarial Search CS30 David Kauchak Spring 2015 Some material borrowed from : Sara Owsley Sood and others.
Game Playing.
AD FOR GAMES Lecture 4. M INIMAX AND A LPHA -B ETA R EDUCTION Borrows from Spring 2006 CS 440 Lecture Slides.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Adversarial Search CS311 David Kauchak Spring 2013 Some material borrowed from : Sara Owsley Sood and others.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Notes on Game Playing by Yun Peng of theYun Peng University of Maryland Baltimore County.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
Game tree search Thanks to Andrew Moore and Faheim Bacchus for slides!
Paula Matuszek, CSC 8520, Fall Based in part on aima.eecs.berkeley.edu/slides-ppt 1 CS 8520: Artificial Intelligence Adversarial Search Paula Matuszek.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Adversarial Search. Regular Tic Tac Toe Play a few games. –What is the expected outcome –What kinds of moves “guarantee” that?
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Adversarial Search 1 (Game Playing)
Adversarial Search Chapter 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
Chapter 5 Adversarial Search. 5.1 Games Why Study Game Playing? Games allow us to experiment with easier versions of real-world situations Hostile agents.
Adversarial Search and Game-Playing
PENGANTAR INTELIJENSIA BUATAN (64A614)
Adversarial Search.
Adversarial Search.
Artificial Intelligence
Game Playing: Adversarial Search
NIM - a two person game n objects are in one pile
Artificial Intelligence
Game Playing: Adversarial Search
Game Playing Chapter 5.
CS51A David Kauchak Spring 2019
Adversarial Search Chapter 6 Section 1 – 4.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Game-playing AIs Part 1 CIS 391 Fall 2007

CSE Intro to AI 2 Games: Outline of Unit Part I (this set of slides)  Motivation  Game Trees  Evaluation Functions Part II  The Minimax Rule  Alpha-Beta Pruning  Game-playing AI successes

CSE Intro to AI 3 Motivation  Games are a form of multi-agent environment What do other agents do and how do they affect our success? Cooperative vs. competitive multi-agent environments. Competitive multi-agent environments give rise to adversarial search a.k.a. games  Why study games? Games are fun! Historical role in AI Studying games teaches us how to deal with other agents trying to foil our plans Huge state spaces – Games are hard! Nice, clean environment with clear criteria for success

CSE Intro to AI 4 The Simple Case  Chess, checkers, go, Mancala, Tic-Tac-Toe, Othello, Nim, …  Two players alternate moves  Zero-sum: one player’s loss is another’s gain  Perfect Information: each player knows the entire game state  Deterministic: no element of chance  Clear set of legal moves  Well-defined outcomes (e.g. win, lose, draw)

CSE Intro to AI 5 More complicated games  Most card games (e.g. Hearts, Bridge, etc.) and Scrabble non-deterministic lacking in perfect information.  Cooperative games  Real-time strategy games (lack alternating moves). e.g. Warcraft

CSE Intro to AI 6 Game setup  Two players: A and B  A moves first and they take turns until the game is over. Winner gets award, loser gets penalty.  Games as search: Initial state: e.g. board configuration of chess Successor function: list of (move,state) pairs specifying legal moves. Terminal test: Is the game finished? Utility function: Gives numerical value of terminal states. E.g. win (+1), lose (-1) and draw (0) in tic-tac-toe  A uses search tree to determine next move.

CSE Intro to AI 7 How to Play a Game by Searching  General Scheme Consider all legal moves, each of which will lead to some new state of the environment (‘board position’) Evaluate each possible resulting board position Pick the move which leads to the best board position. Wait for your opponent’s move, then repeat.  Key problems Representing the ‘board’ Representing legal next boards Evaluating positions Looking ahead

CSE Intro to AI 8 Game Trees  Represent the problem space for a game by a tree  Nodes represent ‘board positions’; edges represent legal moves.  Root node is the position in which a decision must be made.  Evaluation function f assigns real-number scores to `board positions.’  Terminal nodes represent ways the game could end, labeled with the desirability of that ending (e.g. win/lose/draw or a numerical score)

CSE Intro to AI 9 Hexapawn: A very Simple Game  Hexapawn is played on a chessboard cut down to 3x3 squares. A player can move a pawn directly forward one square onto an empty square or move a pawn diagonally forward one square, provided that square contains an opponents pawn. The opponents pawn is removed from the board.  A player P 1 wins the game agains P 2 when: One of P 1 ’s pawns reaches the far side of the board. P 2 cannot move because no legal move is possible. P 2 has no pawns left.

CSE Intro to AI 10 Hexapawn: Three Possible First Moves            White moves

CSE Intro to AI 11 Hexapawn: Simplified Game Tree for 2 Moves                                 ….. Black moves White moves

CSE Intro to AI 12 MAX & MIN Nodes  When I move, I attempt to MAXimize my performance.  When my opponent moves, he or she attempts to MINimize my performance. TO REPRESENT THIS:  If we move first, label the root MAX; if our opponent does, label it MIN.  Alternate labels for each successive tree level. if the root (level 0) is our turn (MAX), all even levels will represent turns for us (MAX), and all odd ones turns for our opponent (MIN).

CSE Intro to AI 13 Evaluation functions  Evaluations how good a ‘board position’ is Based on static features of that board alone  Zero-sum assumption lets us use one function to describe goodness for both players. f(n)>0 if we are winning in position n f(n)=0 if position n is tied f(n)<0 if our opponent is winning in position n  Build using expert knowledge, Tic-tac-toe: f(n)=(# of 3 lengths open for me) - (# open for you)

CSE Intro to AI 14 Chess Evaluation Functions  Alan Turing’s f(n)=(sum of your piece values)- (sum of opponent’s piece values)  More complex: weighted sum of positional features:  Deep Blue has > 8000 features Pawn1.0 Knight3.0 Bishop3.25 Rook5.0 Queen9.0 Pieces values for a simple Turing-style evaluation function often taught to novice chess players Positive: rooks on open files, knights in closed positions, control of the center, developed pieces Negative: doubled pawns, wrong-colored bishops in closed positions, isolated pawns,pinned pieces Examples of more complex features

CSE Intro to AI 15 A Partial Game Tree for Tic-Tac-Toe f(n)=6-4=2 f(n)=6-6=0 f(n)=4-4=0 f(n)=4-3=1 f(n)=4-2=2 -∞ 0 + ∞ f(n)=2 f(n)=0 f(n)=# of potential three-lines for X – # of potential three-line for Y if n is not terminal f(n)=0 if n is a terminal tie f(n)=+ ∞ if n is a terminal win f(n)=- ∞ if n is a terminal loss

CSE Intro to AI 16 Some Chess Positions and their Evaluations White to move f(n)=(9+3)-( ) =-1.25 … Nxg5?? f(n)=(9+3)-(5+5) =2 Uh-oh: Rxg4+ f(n)=(3)-(5+5) =-7 And black may force checkmate So, considering our opponent’s possible responses would be wise.