CompSci 4 27.1 Recursion & Minimax Recursion & the Minimax Algorithm Key to Acing Computer Science If you understand everything, ace your computer science.

Slides:



Advertisements
Similar presentations
Welcome Back to School!!! Mr. Sortina.
Advertisements

1 CS 385 Fall 2006 Chapter 4 Heuristic Search. 2 Heuristics eurisko ("I discover" in Greek) "the study of the methods and rules of discovery and invention."
APPENDIX An Alternative View of the Payoff Matrix n Assume total maximum profits of all oligopolists is constant at 200 units. n Alternative policies.
Game Theory, Part 1 Game theory applies to more than just games. Corporations use it to influence business decisions, and militaries use it to guide their.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
1 CSC 550: Introduction to Artificial Intelligence Fall 2008 search in game playing  zero-sum games  game trees, minimax principle  alpha-beta pruning.
CS 4700: Foundations of Artificial Intelligence Bart Selman Reinforcement Learning R&N – Chapter 21 Note: in the next two parts of RL, some of the figure/section.
Chess AI’s, How do they work? Math Club 10/03/2011.
Lecture 12: Lower bounds By "lower bounds" here we mean a lower bound on the complexity of a problem, not an algorithm. Basically we need to prove that.
New Mexico Computer Science For All More Algorithms Maureen Psaila-Dombrowski.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
AE1APS Algorithmic Problem Solving John Drake..  Previously we introduced matchstick games, using one pile of matches  It is possible to have more than.
CompSci Recursion & Minimax Playing Against the Computer Recursion & the Minimax Algorithm Key to Acing Computer Science If you understand everything,
This time: Outline Game playing The minimax algorithm
Contact My is The course web address is
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Recursion Credits: Jeff Edmonds, Ping Xuan. MULT(X,Y): If |X| = |Y| = 1 then RETURN XY Break X into a;b and Y into c;d e = MULT(a,c) and f =MULT(b,d)
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”
William Shakespeare. Year 7 Your mission if you are willing to accept it, is to learn about William Shakespeare and his plays! Starter game.
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
CISC 235: Topic 6 Game Trees.
Minimax.
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.
Game Playing.
Senior Project – Computer Science – 2015 Modelling Opponents in Board Games Julian Jocque Advisor – Prof. Rieffel Abstract Modelling opponents in a game.
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.
Computer Science 101 Fast Searching and Sorting. Improving Efficiency We got a better best case by tweaking the selection sort and the bubble sort We.
Section 3.1: Proof Strategy Now that we have a fair amount of experience with proofs, we will start to prove more difficult theorems. Our experience so.
Mark Dunlop, Computer and Information Sciences, Strathclyde University 1 Algorithms & Complexity 5 Games Mark D Dunlop.
For Wednesday Read Weiss, chapter 12, section 2 Homework: –Weiss, chapter 10, exercise 36 Program 5 due.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
W 2 L 1 sh 1 C lessons LessonSubjectBook Week 1 lesson 1Objects, names Week 1 lesson 2Statements, layout Week 2 lesson 1Functions, decomposition Week 2.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 What can a computer be commanded to do?
Making Decisions uCode: October Review What are the differences between: o BlueJ o Java Computer objects represent some thing or idea in the real.
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.
Backtracking and Games Eric Roberts CS 106B January 28, 2013.
CSCI 4310 Lecture 6: Adversarial Tree Search. Book Winston Chapter 6.
GAME PLAYING 1. There were two reasons that games appeared to be a good domain in which to explore machine intelligence: 1.They provide a structured task.
Today’s Topics Playing Deterministic (no Dice, etc) Games –Mini-max –  -  pruning –ML and games? 1997: Computer Chess Player (IBM’s Deep Blue) Beat Human.
CompSci 100e 6.1 Plan for the week l More recursion examples l Backtracking  Exhaustive incremental search  When we a potential solution is invalid,
Game tree search Thanks to Andrew Moore and Faheim Bacchus for slides!
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
CompSci Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the.
General Computer Science for Engineers CISC 106 Lecture 06 James Atlas Computer and Information Sciences 06/24/2009.
CPS Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the “right-hand”
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
CPS 100, Spring Search, Backtracking,Heuristics l How do you find a needle in a haystack?  How does a computer play chess?  Why would you write.
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.
CMSC201 Computer Science I for Majors Lecture 19 – Recursion (Continued) Prof. Katherine Gibson Prof. Jeremy Dixon Based on slides from UPenn’s.
Backtracking, Search, Heuristics
CMSC201 Computer Science I for Majors Lecture 20 – Recursion (Continued) Prof. Katherine Gibson Based on slides from UPenn’s CIS 110, and from previous.
Silvia Heubach Department of Mathematics NSS Retreat, May 25, 2017
Intro to Computer Science II
PENGANTAR INTELIJENSIA BUATAN (64A614)
David Kauchak CS52 – Spring 2016
What is an Algorithm? TechNights October 17, 2016.
Checkers Move Prediction Algorithms
NIM - a two person game n objects are in one pile
Search,Sort,Recursion.
Minimax strategies, alpha beta pruning
Team Dont Block Me, National Taiwan University
Last Class We Covered Recursion Stacks Parts of a recursive function:
Backtracking, Search, Heuristics
Minimax strategies, alpha beta pruning
CS51A David Kauchak Spring 2019
Backtracking, Search, Heuristics
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

CompSci Recursion & Minimax Recursion & the Minimax Algorithm Key to Acing Computer Science If you understand everything, ace your computer science course. Otherwise, study & program something you don't understand, then see Key to Acing Computer Science

CompSci Recursion & Minimax Winning Tic-tac-toe Anticipate the implications of your move. Avoid moves which could enable your opponent to win. Attempt moves which would force your opponent to lose, so you win.

CompSci Recursion & Minimax How to pass the buck: recursion! Imagine this: You have all sorts of friends who are willing to help you do your work with two caveats: o They won't do all of your work o They will only do the type of work you have to do Example: How would you do your homework consisting of 100 calculus problems? Easy – do the first problem yourself and ask your friend to do the rest

CompSci Recursion & Minimax How could this approach work? What actually happens is that your friends doing most of your work have friends of their own. Everyone eventually does a small part of the work and piece it back together to do the work in its entirity. In the last example, 100 total people would be working on the homework, each person doing only one problem each and passing on the rest. Important: the person to do the last homework problem does it entirely without help.

CompSci Recursion & Minimax The Parts of Recursion  Base Case – this is the simplest form of the problem which can be solved directly. In the example earlier this would be doing 1 homework problem.  Recursive Step – this is when a smaller identical problem is solved as part of solving the larger problem. In the earlier example, this would be passing along all but one of the homework to a friend.

CompSci Recursion & Minimax Example: Finding the Maximum  Imagine you are given a stack of 1000 unsorted papers with grades on them and told to find the maximum grade.  You can only get help from friends in finding the maximum and in less than the 1000 papers you were given.  What do you ask your friend to do to help you find the maximum in the least effort on your part?

CompSci Recursion & Minimax Example: Sorting  Now imagine you must sort those 1000 papers by grade. Define a recursive algorithm to solve this problem. To do this define two parts:  What is the simplest number of papers to sort, and how would you sort them?  How would you divide the task in to smaller sorting tasks and integrate theses solutions to sort the entire set of N papers?

CompSci Recursion & Minimax The Problem Your Moves My Moves Your Moves My Moves..... Your Moves.....

CompSci Recursion & Minimax Example: the Minimax Algorithm  In many games, one players loss is another player's gain.  A winning strategy for this type of game is to minimize the maximum potential gain of your opponent and assume your opponent is following the same strategy.  Better than brute force lookahead:  Consider all possible moves to the bitter end  Pick the move that leads to a win, if possible  Why not program Computer Chess that way?

CompSci Recursion & Minimax Example: the Minimax Algorithm  Since your opponent is following the same strategy, and game moves eventually end the game, this algorithm can be implemented recursively. Anticipate the implications of your move. Avoid moves which could enable your opponent to win. Attempt moves which would force your opponent to lose, so you win.

CompSci Recursion & Minimax A Winning Computer Player for Tic-tac-toe  What is the algorithm? Assume the input is a board and whose turn it is (X or O): evaluate(board, position)  What is the base case? What is the simplest board to evaluate win, loss, or cat outcome? Remember you assume both players are doing everything possible to win.  What is the recursive step? Spend the next 10 minutes discussing the answers in small groups. Use pseudocode to answer.