CS51A David Kauchak Spring 2019

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.
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Computers playing games. One-player games Puzzle: Place 8 queens on a chess board so that no two queens attack each other (i.e. on the same row, same.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
Artificial Intelligence in Game Design
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
Game Playing CSC361 AI CSC361: Game Playing.
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: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
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.
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.
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.
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.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
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!)
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
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.
1 Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game.
Game playing Types of games Deterministic vs. chance
Adversarial Search and Game-Playing
ADVERSARIAL GAME SEARCH: Min-Max Search
Adversarial Environments/ Game Playing
Announcements Homework 1 Full assignment posted..
Instructor: Vincent Conitzer
4. Games and adversarial search
Last time: search strategies
PENGANTAR INTELIJENSIA BUATAN (64A614)
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Adversarial Search.
Game Playing.
David Kauchak CS52 – Spring 2016
CS 4700: Foundations of Artificial Intelligence
Adversarial Search Chapter 5.
Expectimax Lirong Xia. Expectimax Lirong Xia Project 2 MAX player: Pacman Question 1-3: Multiple MIN players: ghosts Extend classical minimax search.
Artificial Intelligence
Artificial Intelligence
Game playing.
Game Playing: Adversarial Search
NIM - a two person game n objects are in one pile
Artificial Intelligence
Instructor: Vincent Conitzer
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Minimax strategies, alpha beta pruning
Game Playing Fifth Lecture 2019/4/11.
Game Playing: Adversarial Search
CSE (c) S. Tanimoto, 2007 Search 2: AlphaBeta Pruning
Game Playing Chapter 5.
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Minimax strategies, alpha beta pruning
Adversarial Search Game Theory.
CS51A David Kauchak Spring 2019
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

CS51A David Kauchak Spring 2019 Adversarial Search CS51A David Kauchak Spring 2019 Some material borrowed from : Sara Owsley Sood and others

Admin Assignment 10

A quick review of search Problem solving via search: To define the state space, define three things: is_goal next_states starting state Uninformed search vs. informed search what’s the difference? what are the techniques we’ve seen? pluses and minuses?

Why should we study games? Clear success criteria Important historically for AI Fun  Good application of search hard problems (chess 35100 states in search space, 1040 legal states) Some real-world problems fit this model game theory (economics) multi-agent problems

Types of games What are some of the games you’ve played?

Types of games: game properties single-player vs. 2-player vs. multiplayer Fully observable (perfect information) vs. partially observable Discrete vs. continuous real-time vs. turn-based deterministic vs. non-deterministic (chance)

Strategic thinking = intelligence ? Strategic thinking = intelligence For reasons previously stated, two-player games have been a focus of AI since its inception… Important question: Is strategic thinking the same as intelligence?

Strategic thinking = intelligence ? Strategic thinking = intelligence Humans and computers have different relative strengths in these games: humans computers ? ?

Strategic thinking = intelligence ? Strategic thinking = intelligence Humans and computers have different relative strengths in these games: humans computers good at evaluating the strength of a board for a player good at looking ahead in the game to find winning combinations of moves

Strategic thinking = intelligence ? Strategic thinking = intelligence How could you figure out how humans approach playing chess? humans good at evaluating the strength of a board for a player

How humans play games… An experiment was performed in which chess positions were shown to novice and expert players… - experts could reconstruct these perfectly - novice players did far worse…

How humans play games… Random chess positions (not legal ones) were then shown to the two groups experts and novices did just as badly at reconstructing them!

People are still working on this problem… http://people.brunel.ac.uk/~hsstffg/frg-research/chess_expertise/

Tic Tac Toe as search If we want to write a program to play tic tac toe, what question are we trying to answer? Given a state (i.e. board configuration), what move should we make!

Tic Tac Toe as search X

Tic Tac Toe as search X X O O O X O X X O

Tic Tac Toe as search How can we pose this as a search problem?

Tic Tac Toe as search X X … X

Tic Tac Toe as search X X O X O X … O …

… Tic Tac Toe as search LOSE WIN TIE X X O X X O X X O X O O X X O O X Eventually, we’ll get to a leaf X X O X X O X X O X O O X X O … O X O X O X O O X O X LOSE WIN TIE How does this help us? Try and make moves that move us towards a win, i.e. where there are leaves with a WIN.

Tic Tac Toe X’s turn … O’s turn … X’s turn … … … Problem: we don’t know what O will do

I’m X, what will ‘O’ do? X O O’s turn

Minimizing risk The computer doesn’t know what move O (the opponent) will make It can assume that it will try and make the best move possible Even if O actually makes a different move, we’re no worse off. Why? X O

Optimal Strategy An Optimal Strategy is one that is at least as good as any other, no matter what the opponent does If there's a way to force the win, it will Will only lose if there's no other option

Defining a scoring function X X O X X O X X O X O O X X O … O X O X O X O O X O X LOSE WIN TIE +1 -1 Idea: define a function that gives us a “score” for how good each state is higher scores mean better

Defining a scoring function X X O Our (X) turn O O X O X What should be the score of this state? +1: we can get to a win

Defining a scoring function X X O Opponent’s (O) turn O X O X What should be the score of this state? -1: we can get to a win

Defining a scoring function X O -1 Opponent’s (O) turn +1 -1

Defining a scoring function X O Our (X) turn O X What should be the score of this state?

Defining a scoring function X O Our (X) turn O X X O O turn O What’s the score of this state? X X X O X O X O O X O O O O O X turn +1 O +1 O +1 +1 X O X X X X X X X X O O X O X O X O O X O X O O +1 O O +1 +1 +1 X X X X X X X O X X X

Defining a scoring function X O What’s the score of this state? Our (X) turn +1 O X X O O turn +1 O X X O X O X O X O X O O O O O X turn +1 O +1 O +1 +1 X O X X X X X X X X O O X O X O X O O X O X O O +1 O O +1 +1 +1 X X X X X X X O X X X

Defining a scoring function X Our (X) turn O What should be the score of this state? 0: If we play perfectly and so does O, the best we can do is a tie (could do better if O makes a mistake)

How can X play optimally?

How can X play optimally? When it’s my turn, pick the highest scoring state When it’s the opponent’s turn, assume the lowest scoring state (from my perspective) If we can reach the end games, we can percolate these answers all the way back up

How can X play optimally? Start from the leaves and propagate the score up: if X’s turn, pick the move that maximizes the utility if O’s turn, pick the move that minimizes the utility Is this optimal?

Minimax Algorithm: An Optimal Strategy minimax(state) = if state is a terminal state score(state) else if MY turn over all next states, s: return the maximum of minimax(s) else if OPPONENTS turn over all next states, s: return the minimum of minimax(s) Uses recursion to compute the “value” of each state Searches down to the leaves, then the values are “backed up” through the tree as the recursion finishes What type of search is this? What does this assume about how MIN will play? What if this isn’t true? Note: We can't always search all the way down to the bottom of the tree…

Baby Nim What move should I take? MAX MIN MAX MIN MAX Take 1 or 2 at each turn Goal: take the last match MAX What move should I take? MIN MAX