CPSC 322 Introduction to Artificial Intelligence October 22, 2004.

Slides:



Advertisements
Similar presentations
Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Advertisements

CMSC 471 Spring 2014 Class #9 Tue 2/25/14 Game Playing Professor Marie desJardins,
Game Playing CS 63 Chapter 6
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.
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Games & Adversarial Search
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
COMP-4640: Intelligent & Interactive Systems Game Playing A game can be formally defined as a search problem with: -An initial state -a set of operators.
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.
Artificial Intelligence for Games Game playing Patrick Olivier
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Adversarial Search Board games. Games 2 player zero-sum games Utility values at end of game – equal and opposite Games that are easy to represent Chess.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
CPSC 322 Introduction to Artificial Intelligence October 25, 2004.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
MAE 552 – Heuristic Optimization Lecture 28 April 5, 2002 Topic:Chess Programs Utilizing Tree Searches.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
ICS-270a:Notes 5: 1 Notes 5: Game-Playing ICS 270a Winter 2003.
CSC 412: AI Adversarial Search
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
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.
CPSC 322 Introduction to Artificial Intelligence November 12, 2004.
Game Playing.
Game Playing ECE457 Applied Artificial Intelligence Spring 2007 Lecture #5.
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.
Games as Game Theory Systems (Ch. 19). Game Theory It is not a theoretical approach to games Game theory is the mathematical study of decision making.
Game-playing AIs Part 1 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part I (this set of slides)  Motivation  Game Trees  Evaluation.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.
Game Playing. Towards Intelligence? Many researchers attacked “intelligent behavior” by looking to strategy games involving deep thought. Many researchers.
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.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
Artificial Intelligence
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search. Regular Tic Tac Toe Play a few games. –What is the expected outcome –What kinds of moves “guarantee” that?
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Luca Weibel Honors Track: Competitive Programming & Problem Solving Partisan game theory.
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.
1 Chapter 6 Game Playing. 2 Chapter 6 Contents l Game Trees l Assumptions l Static evaluation functions l Searching game trees l Minimax l Bounded lookahead.
Game Playing Why do AI researchers study game playing?
PENGANTAR INTELIJENSIA BUATAN (64A614)
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
CSC 110 – Fluency in Information Technology Chess
CPSC 322 Introduction to Artificial Intelligence
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
The Alpha-Beta Procedure
Games CSE 473 – Autumn 2003.
Mini-Max search Alpha-Beta pruning General concerns on games
Artificial Intelligence
Games & Adversarial Search
Adversarial Search CS 171/271 (Chapter 6)
CS51A David Kauchak Spring 2019
Games & Adversarial Search
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

CPSC 322 Introduction to Artificial Intelligence October 22, 2004

Things... Office hours today from 3:30 to 4:30 pm Bring me your first midterms before the second midterm if you want to be retested on problem 3 asgn3 will be posted this evening Jessica Hodgins talk, Thursday, October 28, 1-2pm, MacLeod 214

Helpful CILOG stuff Counting elements in a list /* This works in Prolog, but not in CILOG */ length([H|T],N) 0 & N1 is N-1 & length(T,N1). length([],0). /* This works in CILOG */ length([H|T],X,Y) <- X1 is X+1 & length(T,X1,Y). length([],X,X). cilog: ask length([a,b,c],0,X). Answer: length([a, b, c], 0, 3).

Helpful CILOG stuff Sorting numeric elements in a list using insertion sort insert(X,[],[X]). insert(X,[Y|Ys],[X,Y|Ys]) <- X =< Y. insert(X,[Y|Ys],[Y|Zs]) Y & insert(X,Ys,Zs). sort([],[]). sort([X|Xu],Ys) <- sort(Xu,Zs) & insert(X,Zs,Ys).

The Joy of Hex The game of hexapawn 3 x 3 board 3 pawns on each side movement of pawns: white moves first pawn can move straight ahead one space if that space is empty pawn can move diagonally one space forward to capture opponent’s pawn occupying that space

The Joy of Hex The game of hexapawn 3 ways to win: capture all your opponent’s pawns one of your pawns reaches the opposite end of the board it’s your opponent’s turn but your opponent can’t move

Two Questions Second, how do you know which move to make? Use heuristic knowledge, of course! In this case, we apply this very crude board evaluation function: if you have won then board value = +10 else if opponent has won then board value = -10 else board value = number of your pawns - number of opponent’s pawns The board evaluation function is applied like this....

W W W B B B opponent’s - W W move --> W - - B B B your --> - W W - W W - W W responses B - - W B - W - B B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B -

W W W B B B opponent’s - W W move --> W - - B B B your --> - W W - W W - W W responses B - - W B - W - B B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B

W W W B B B opponent’s - W W move --> W - - B B B your --> - W W - W W - W W responses B W B W - B -10 B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B

W W W B B B opponent’s - W W move --> W B B B your --> - W W - W W - W W responses B W B W - B -10 B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B

W W W B B B opponent’s - W W move --> W B B B your --> - W W response B B - B opp’s moves --> - - W - - W - W - W - - B W - B - W B - B B - B B - B 0 1 1

What if white makes an unexpected move?

W W W B B B opponent’s - W W move --> W B B B your --> - W W response B B - B opp’s move --> - - W W - - B - B 0 not this...

W W W B B B opponent’s - W W move --> W B B B your --> - W W response B B - B opp’s move --> - - W B W - B - B 1...but this

What if white makes a different move? Apply this search technique again to white’s move and make your next move accordingly

your - W W move --> B - - B - B opponent’s - - W move --> B W - B - B

your - W W move --> B - - B - B opponent’s - - W move --> B W - B - B your B - W - - W - - W - - W responses -> - W - B B - B B - B W B B - B - - B B - - B - - opponent’s W - - W moves --> B W - B B W B W - B B W B - B B - B - - B - - B B - - B - - W - - B W -

your - W W move --> B - - B - B opponent’s - - W move --> B W - B - B your B - W - - W - - W - - W responses -> - W - B B - B B - B W B B - B - - B B - - B opponent’s W - - W moves --> B W - B B W B W - B B W B - B B - B - - B - - B B - - B - - W - - B W

your - W W move --> B - - B - B opponent’s - - W move --> B W - B - B your B - W - - W - - W - - W responses -> - W - B B - 1 B B - 1 B W B -10 B - B - - B B - - B opponent’s W - - W moves --> B W - B B W B W - B B W B - B B - B - - B - - B B - - B - - W - - B W

your - W W move --> B - - B - B opponent’s - - W move --> B W - 10 B - B your B - W - - W - - W - - W responses -> - W - B B - 1 B B - 1 B W B -10 B - B - - B B - - B opponent’s W - - W moves --> B W - B B W B W - B B W B - B B - B - - B - - B B - - B - - W - - B W

your - W W move --> B - - B - B opponent’s - - W move --> B W - 10 B - B your B - W response -> - W - B - B 10

What if...?...way back at the beginning there was an obvious win for you in your search space?

W W W B B B opponent’s - W W move --> W - - B B B your --> - W W - W W - W W responses B - - W B - W - B B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B

W W W B B B opponent’s - W W move --> W - - B B B should you move here? your --> - W W - W W - W W responses B - - W B - W - B B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B

W W W B B B opponent’s - W W move --> W - - B B B NOOOOO!!!! your --> - W W - W W - W W responses B - - W B - W - B B - B B - B B B - opp’s moves --> - - W - - W - W - - W - - W - - W W - - W - - W W - - B W - B - W W W - W B W - - B W W B W - W B - B B - B B - B B - B B - B B W - B B - B B

Game search (also known as adversarial search) has these components: move (or board) generator static board evaluation function (this is the heuristic part - it doesn’t generate moves or look ahead - it’s static) minimax algorithm to alternately propagate minima and maxima upward from “bottom”

Minimax algorithm Start with the following: a) there are two players, MAX and MIN b) it’s MAX’s turn to move c) MAX has a static board evaluation function that returns bigger values if a board is favorable to MAX d) the evaluation function gets better as the game gets closer to a goal state (else why bother to generate the game space?) e) MAX believes that MIN’s evaluation function is no better than MAX’s (if that’s not true, then MAX should at least avoid betting money on this game)

Minimax algorithm 1.Generate the game tree to as many levels (plies) that time and space constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on. 2.Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values 3.Use those terminal board values to determine the values to be assigned to the immediate parents: a) if the parent is at a MIN level, then the value is the minimum of the values of its children b) if the parent is at a MAX level, then the value is the maximum of the values of its children 4.Keep propagating values upward as in step 3 5.When the values reach the top of the game tree, MAX chooses the move indicated by the highest value

Minimax algorithm 1.Generate the game tree to as many levels (plies) that time and space constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on. 2.Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values 3.Use those terminal board values to determine the values to be assigned to the immediate parents: a) if the parent is at a MIN level, then the value is the minimum of the values of its children b) if the parent is at a MAX level, then the value is the maximum of the values of its children 4.Keep propagating values upward as in step 3 5.When the values reach the top of the game tree, MAX chooses the move indicated by the highest value

Minimax algorithm MAX (it’s MAX’s turn to move)

Minimax algorithm MAX (it’s MAX’s turn to move) MIN

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm 1.Generate the game tree to as many levels (plies) that time and space constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on. 2.Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values 3.Use those terminal board values to determine the values to be assigned to the immediate parents: a) if the parent is at a MIN level, then the value is the minimum of the values of its children b) if the parent is at a MAX level, then the value is the maximum of the values of its children 4.Keep propagating values upward as in step 3 5.When the values reach the top of the game tree, MAX chooses the move indicated by the highest value

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm 1.Generate the game tree to as many levels (plies) that time and space constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on. 2.Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values 3.Use those terminal board values to determine the values to be assigned to the immediate parents: a) if the parent is at a MIN level, then the value is the minimum of the values of its children b) if the parent is at a MAX level, then the value is the maximum of the values of its children 4.Keep propagating values upward as in step 3 5.When the values reach the top of the game tree, MAX chooses the move indicated by the highest value

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm 1.Generate the game tree to as many levels (plies) that time and space constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on. 2.Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values 3.Use those terminal board values to determine the values to be assigned to the immediate parents: a) if the parent is at a MIN level, then the value is the minimum of the values of its children b) if the parent is at a MAX level, then the value is the maximum of the values of its children 4.Keep propagating values upward as in step 3 5.When the values reach the top of the game tree, MAX chooses the move indicated by the highest value

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm 1.Generate the game tree to as many levels (plies) that time and space constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on. 2.Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values 3.Use those terminal board values to determine the values to be assigned to the immediate parents: a) if the parent is at a MIN level, then the value is the minimum of the values of its children b) if the parent is at a MAX level, then the value is the maximum of the values of its children 4.Keep propagating values upward as in step 3 5.When the values reach the top of the game tree, MAX chooses the move indicated by the highest value

Minimax algorithm MAX (it’s MAX’s turn to move) MIN MAX MIN MAX

Minimax algorithm MAX (it’s MAX’s turn to move) MIN 7 7

Minimax algorithm A simple but powerful technique......how powerful is it?

Deep Blue vital statistics: 200,000,000 moves per second 480 custom chess-playing chips 1997

Deep Blue Garry Kasparov vital statistics: 200,000,000 moves per second 3 moves per second 480 custom chess-playing chips meat 1997

Deep Blue defeats Garry Kasparov 3.5 games to 2.5 games Kasparov wins $400,000 Deep Blue wins $700,000 The human race is humiliated 1997

2003 Garry Kasparov takes on Deep Junior

Deep Junior and Garry Kasparov tie 3 games each Kasparov wins $500,000 just for being there Deep Junior and Kasparov split another $500,000 Honor of human race is restored 2003

Deep Junior and Garry Kasparov tie 3 games each Kasparov wins $500,000 just for being there Deep Junior and Kasparov split another $500,000 Honor of human race is restored...or is it? 2003

Computer chess rankings have increased about 200 points every 5 years, due in large part to increases in CPU speed

Deep Blue Deep Junior vital statistics: 200,000,000 moves per second 3,000,000 moves per second 480 custom chess-playing chips GHz Intel processors But speed doesn’t explain Deep Junior

Deep Junior 8 Chess Playing Software by ChessBase Two Exclusive Bonuses!!Deep Junior 8 - Tips, ToolsTwo Exclusive Bonuses!!Deep Junior 8 - Tips, Tools and Tactics plus Chess Masterpiecesand Tactics plus Chess Masterpieces Deep Junior 8 with Two Chess Engines!! * Fritz 8 User Interface * Complete Training Functions * Tournament Book * HUGE Database * 3D Boards * Free Access to Playchess.com Special Pricing $79.95 (US) Deep Junior 8 - Double World Champion! This chess program, written by the Israelis Amir Ban and Shay Bushinsky, has achieved everything it could wish for. Junior won the Computer Chess World Championship in 2001 and 2002, and it can look back on a string of successes against human beings in tournaments and matches. Unforgettable was its performance against Garry Kasparov in the "Man vs Machine" match in New York in January With millions of people following on the Internet, double world champion Junior played exciting, imaginative chess to hold the world’s strongest player to a 3:3 draw. Deep Junior 8 - You've Got to Love it! You're going to love Junior 8 and its tremendous attacking style. Junior 8 shows a new quality of computer chess. It has a deep understanding of initiative and attacking chances and likes to sacrifice material more than any other existing chess program. Many of the world's strongest players already use Junior as their analytical partner. It is considered one of the most reliable tactical programs around. Junior’s unique style is very human-like in often preferring positional advantages to material. from