Ch.4 AI and Games. Hantao Zhang. The University of Iowa Department of Computer Science. hzhang/c145

Similar documents
Game playing. Chapter 5, Sections 1{5. AIMA Slides cstuart Russell and Peter Norvig, 1998 Chapter 5, Sections 1{5 1

Game playing. Outline

Game Playing. Dr. Richard J. Povinelli. Page 1. rev 1.1, 9/14/2003

Game playing. Chapter 5. Chapter 5 1

Game playing. Chapter 6. Chapter 6 1

Outline. Game playing. Types of games. Games vs. search problems. Minimax. Game tree (2-player, deterministic, turns) Games

CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH. Santiago Ontañón

Games vs. search problems. Game playing Chapter 6. Outline. Game tree (2-player, deterministic, turns) Types of games. Minimax

Game playing. Chapter 6. Chapter 6 1

Games vs. search problems. Adversarial Search. Types of games. Outline

Artificial Intelligence. Topic 5. Game playing

CS 380: ARTIFICIAL INTELLIGENCE

Game Playing. Philipp Koehn. 29 September 2015

ADVERSARIAL SEARCH. Chapter 5

Game Playing: Adversarial Search. Chapter 5

Game playing. Chapter 5, Sections 1 6

Lecture 5: Game Playing (Adversarial Search)

Adversarial search (game playing)

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 4: Search 3.

Today. Nondeterministic games: backgammon. Algorithm for nondeterministic games. Nondeterministic games in general. See Russell and Norvig, chapter 6

CS 188: Artificial Intelligence Spring Game Playing in Practice

Game Playing. Why do AI researchers study game playing? 1. It s a good reasoning problem, formal and nontrivial.

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search

Artificial Intelligence. Minimax and alpha-beta pruning

Programming Project 1: Pacman (Due )

Games CSE 473. Kasparov Vs. Deep Junior August 2, 2003 Match ends in a 3 / 3 tie!

Adversarial Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 9 Feb 2012

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro) 1

Adversarial Search and Game Playing

Adversarial Search. CMPSCI 383 September 29, 2011

Last update: March 9, Game playing. CMSC 421, Chapter 6. CMSC 421, Chapter 6 1

CS 188: Artificial Intelligence

Artificial Intelligence Adversarial Search

COMP219: Artificial Intelligence. Lecture 13: Game Playing

CS 188: Artificial Intelligence Spring Announcements

Adversarial Search (a.k.a. Game Playing)

CS 331: Artificial Intelligence Adversarial Search II. Outline

Game Playing AI Class 8 Ch , 5.4.1, 5.5

Intuition Mini-Max 2

Adversarial Search. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 5

Artificial Intelligence 1: game playing

Game Playing State-of-the-Art CSE 473: Artificial Intelligence Fall Deterministic Games. Zero-Sum Games 10/13/17. Adversarial Search

Announcements. CS 188: Artificial Intelligence Spring Game Playing State-of-the-Art. Overview. Game Playing. GamesCrafters

Game-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence

CSE 573: Artificial Intelligence Autumn 2010

Adversarial Search (Game Playing)

Adversarial Search Lecture 7

CS 771 Artificial Intelligence. Adversarial Search

Adversarial Search and Game- Playing C H A P T E R 6 C M P T : S P R I N G H A S S A N K H O S R A V I

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram

Outline. Game Playing. Game Problems. Game Problems. Types of games Playing a perfect game. Playing an imperfect game

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro, Diane Cook) 1

CS 188: Artificial Intelligence Spring 2007

CSE 473: Artificial Intelligence. Outline

CS 188: Artificial Intelligence. Overview

Artificial Intelligence

Game-Playing & Adversarial Search

6. Games. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Mechanical Turk. Origins. origins. motivation. minimax search

Announcements. Homework 1. Project 1. Due tonight at 11:59pm. Due Friday 2/8 at 4:00pm. Electronic HW1 Written HW1

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter Read , Skim 5.7

Artificial Intelligence

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter , 5.7,5.8

Ar#ficial)Intelligence!!

Adversarial Search and Game Playing. Russell and Norvig: Chapter 5

Adversarial Search. Human-aware Robotics. 2018/01/25 Chapter 5 in R&N 3rd Ø Announcement: Slides for this lecture are here:

CITS3001. Algorithms, Agents and Artificial Intelligence. Semester 2, 2016 Tim French

Artificial Intelligence

Game Playing State-of-the-Art

Prepared by Vaishnavi Moorthy Asst Prof- Dept of Cse

CS 5522: Artificial Intelligence II

Game Playing State of the Art

CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5

CS 4700: Foundations of Artificial Intelligence

Artificial Intelligence

Adversarial Search Aka Games

Artificial Intelligence

Adversarial Search. Read AIMA Chapter CIS 421/521 - Intro to AI 1

Games (adversarial search problems)

Foundations of Artificial Intelligence

Foundations of AI. 6. Adversarial Search. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard & Bernhard Nebel

CS 188: Artificial Intelligence

Game Playing State-of-the-Art. CS 188: Artificial Intelligence. Behavior from Computation. Video of Demo Mystery Pacman. Adversarial Search

Foundations of Artificial Intelligence

Unit-III Chap-II Adversarial Search. Created by: Ashish Shah 1

Games and Adversarial Search

Artificial Intelligence Search III

Adversarial Search: Game Playing. Reading: Chapter

Foundations of AI. 6. Board Games. Search Strategies for Games, Games with Chance, State of the Art

School of EECS Washington State University. Artificial Intelligence

ARTIFICIAL INTELLIGENCE (CS 370D)

Contents. Foundations of Artificial Intelligence. Problems. Why Board Games?

Adversarial Search 1

Chapter 6. Overview. Why study games? State of the art. Game playing State of the art and resources Framework

CSE 473: Artificial Intelligence Autumn 2011

CS440/ECE448 Lecture 9: Minimax Search. Slides by Svetlana Lazebnik 9/2016 Modified by Mark Hasegawa-Johnson 9/2017

CSE 573: Artificial Intelligence

CPS 570: Artificial Intelligence Two-player, zero-sum, perfect-information Games

Foundations of AI. 5. Board Games. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard and Luc De Raedt SA-1

Transcription:

Ch.4 AI and Games Hantao Zhang http://www.cs.uiowa.edu/ hzhang/c145 The University of Iowa Department of Computer Science Artificial Intelligence p.1/29

Chess: Computer vs. Human Deep Blue is a chess-playing computer developed by IBM. On February 10, 1996, Deep Blue became the first machine to win a chess game against a reigning world champion (Garry Kasparov) under regular time controls. On 11 May 1997, the machine won a six-game match by two wins to one with three draws against world champion Garry Kasparov. Artificial Intelligence p.2/29

Chess: Computer vs. Human Deep Fritz is a German chess program developed by Frans Morsch and Mathias Feist and published by ChessBase. In 2002, Deep Fritz drew the Brains in Bahrain match against the classical World Chess Champion Vladimir Kramnik 4-4. On June 23, 2005, in the ABC Times Square Studios, Fritz 9 drew against the then FIDE World Champion Rustam Kasimdzhanov. From 25 November-5 December 2006 Deep Fritz played a six game match against Kramnik in Bonn. Fritz was able to win 4-2. Artificial Intelligence p.3/29

Rybka: Computer Chess Rybka is a computer chess engine designed by International Master Vasik Rajlich. As of February 2011, Rybka is one of the top-rated engines on chess engine rating lists and has won many computer chess tournaments. Rybka won four consecutive World Computer Chess Championships from 2007 to 2010, but it was stripped of these titles in June 2011 because that Rybka plagiarized code from both the Crafty and the Fruit chess engines. Others dispute this. Rybka 2.2n2 is available as a free download and Deep Rybka 3 is ranked first among all computer chess programs in 2010. Rybka uses a bitboard representation, and is an alpha-beta searcher with a relatively large aspiration window. It uses very aggressive pruning, leading to imbalanced search trees. Artificial Intelligence p.4/29

Zappa: Computer Chess Zappa is a chess engine written by Anthony Cozzie, a graduate student at the University of Illinois at Urbana-Champaign. The program emphasizes sound search and a good use of multiple processors. Zappa scored an upset victory at the World Computer Chess Championship in August, 2005, in Reykjavmk, Iceland. Zappa won with a score of 10 out of 11, and beat both Junior and Shredder, programs that had won the championship many times. Zappa s other tournament successes include winning CCT7 and defeating Grandmaster Jaan Ehlvest 3-1. In Mexico in September 2007 Zappa won a match against Rybka by a score of 5.5 to 4.5. In March 2008 Anthony Cozzie announced that the Zappa project is 100% finished", which includes both tournaments and future releases. In June 2010, Zach Wegner announced that he had acquired the rights to maintain and improve the Zappa engine. The improved engine competed in the 2010 WCCC under the name Rondo, achieving second place behind Rybka. Artificial Intelligence p.5/29

Games vs. Search problems Unpredictable opponent: Solution is a contingency plan Time limits: Unlikely to find the best step, must approximate Game types: perfect information imperfect information deterministic chess, checkers, go, othello chance backgammon monopoly bridge, poker, scrabble blackjack Artificial Intelligence p.6/29

Tic-Tac-Toe MA () MIN (O) MA () O O O... MIN (O) O O O............... TERMINAL Utility O O O O O O O O O O 1 0 +1... Artificial Intelligence p.7/29

Minimax Perfect play for deterministic, perfect-information games Idea: choose move to position with highest minimax value = best achievable payoff against best play E.g., 2-ply game: MA 3 A 1 A 2 A 3 MIN 3 2 2 A 11 A 13 A 21 A 22 A 23 A 32 A 33 A 12 A 31 3 12 8 2 4 6 14 5 2 Artificial Intelligence p.8/29

Minimax Algorithm function MINIMA-DECISION(game) returns an operator for each op in OPERATORS[game] do VALUE[op] MINIMA-VALUE(APPLY(op, game), game) end return the op with the highest VALUE[op] function MINIMA-VALUE(state, game) returns a utility value if TERMINAL-TEST[game](state) then return UTILITY[game](state) else if MA is to move in state then return the highest MINIMA-VALUE of SUCCESSORS(state) else return the lowest MINIMA-VALUE of SUCCESSORS(state) Artificial Intelligence p.9/29

Properties of Minimax Complete: Yes, if tree is finite (chess has specific rules for this) Optimal: Yes, against an optimal opponent. Otherwise?? Time complexity: O(b m ) Space complexity: O(bm) (depth-first exploration) For chess, b 35, m 100 for reasonable games best exact solution infeasible Artificial Intelligence p.10/29

Resource Limits Suppose we have 100 seconds, explore 10 4 nodes/second 10 6 nodes per move Standard approach: cutoff test e.g., depth limit evaluation function = estimated desirability of position and explore only (hopeful) nodes with certain values Artificial Intelligence p.11/29

Digression: Exact values don t matter MA MIN 1 2 1 20 1 2 2 4 1 20 20 400 Behaviour is preserved under any monotonic transformation of EVAL Only the order matters: payoff in deterministic games acts as an ordinal utility function Artificial Intelligence p.12/29

Cutting Off Search MINIMACUTOFF is identical to MINIMAVALUE except 1. TERMINAL? is replaced by CUTOFF? 2. UTILITY is replaced by EVAL Does it work in practice? b m = 10 6, b = 35 m = 4 4-ply human novice 8-ply typical PC, human master 12-ply Deep Blue, Kasparov Artificial Intelligence p.13/29

α β Pruning Example MA 3 MIN 3 2 2 3 12 8 2 4 6 14 5 2 Artificial Intelligence p.14/29

α β Pruning Example MA 3 MIN 3 2 3 12 8 2 Artificial Intelligence p.15/29

α β Pruning Example MA 3 MIN 3 2 14 3 12 8 2 14 Artificial Intelligence p.16/29

α β Pruning Example MA 3 MIN 3 2 14 5 3 12 8 2 14 5 Artificial Intelligence p.17/29

α β Pruning Example MA 3 3 MIN 3 2 14 5 2 3 12 8 2 14 5 2 Artificial Intelligence p.18/29

The α β algorithm function MA-VALUE(state, game,, ) returns the minimax value of state inputs: state, current state in game game, game description, the best score for MA along the path to state, the best score for MIN along the path to state if CUTOFF-TEST(state) then return EVAL(state) for each s in SUCCESSORS(state) do MA(, MIN-VALUE(s, game,, )) if then return end return function MIN-VALUE(state, game,, ) returns the minimax value of state if CUTOFF-TEST(state) then return EVAL(state) for each s in SUCCESSORS(state) do MIN(, MA-VALUE(s, game,, )) if then return end return Artificial Intelligence p.19/29

Good Move Ordering Is Important MA 3 MIN 3 2 2 3 12 8 2 4 6 14 5 2 Artificial Intelligence p.20/29

Properties of α β Pruning does not affect final result. Good move ordering improves effectiveness of pruning. With perfect ordering, time complexity = O(b m/2 ) doubles depth of search can easily reach depth 8 and play good chess A simple example of the value of reasoning about which computations are relevant (a form of metareasoning) Artificial Intelligence p.21/29

Why is it called α β? MA MIN...... MA MIN V α is the best value (to MA) found so far off the current path If V is worse than α, MA will avoid it prune that branch Similarly, β is the best value for MIN. Artificial Intelligence p.22/29

Deterministic Games in Practice Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in 1994. Used an endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 443,748,401,247 positions. Othello: human champions refuse to compete against computers, who are too good. Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves. Artificial Intelligence p.23/29

Nondeterministic games In backgammon, the dice rolls determine the legal moves Simplified example with coin-flipping instead of dice-rolling: MA CHANCE 3 1 0.5 0.5 0.5 0.5 MIN 2 4 0 2 2 4 7 4 6 0 5 2 Artificial Intelligence p.24/29

Algorithm for Nondeterministic Games EPECTIMINIMA gives perfect play Just like MINIMA, except we must also handle chance nodes:... if state is a chance node then return average of EPECTIMINIMAVALUE of SUCCESSORS(state)... A version of α β pruning is possible but only if the leaf values are bounded. Artificial Intelligence p.25/29

Nondeterministic games in practice Dice rolls increase b: 21 possible rolls with 2 dice Backgammon 20 legal moves (can be 6,000 with 1-1 roll) depth 4 = 20 (21 20) 3 1.2 10 9 As depth increases, probability of reaching a given node shrinks value of lookahead is diminished α β pruning is much less effective TDGAMMON uses depth-2 search + very good EVAL world-champion level Artificial Intelligence p.26/29

Exact values DO matter MA DICE 2.1 1.3.9.1.9.1 21 40.9.9.1.9.1 MIN 2 3 1 4 20 30 1 400 2 2 3 3 1 1 4 4 20 20 30 30 1 1 400 400 Behaviour is preserved only by positive linear transformation of EVAL Hence EVAL should be proportional to the expected payoff Artificial Intelligence p.27/29

Games of imperfect information Examples include card games, where opponent s initial cards are unknown Typically we can calculate a probability for each possible deal. Seems just like having one big dice roll at the beginning of the game Idea: compute the minimax value of each action in each deal, then choose the action with highest expected value over all deals Special case: if an action is optimal for all deals, it s optimal. GIB, current best bridge program, approximates this idea by 1) generating 100 deals consistent with bidding information, 2) picking the action that wins most tricks on average Artificial Intelligence p.28/29

Summary Games are fun to work on! They illustrate several important points about AI. perfection is unattainable must approximate good idea to think about what to think about uncertainty constrains the assignment of values to states Games are to AI as grand prix racing is to automobile design. Artificial Intelligence p.29/29