AI for Connect-4 (or other 2-player games) Minds and Machines.

Slides:



Advertisements
Similar presentations
Artificial Intelligence: The Search Method
Advertisements

Game Playing CS 63 Chapter 6
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)
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.
Game Playing Games require different search procedures. Basically they are based on generate and test philosophy. At one end, generator generates entire.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
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.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
Artificial Intelligence in Game Design
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
Problem Solving Using Search Reduce a problem to one of searching a graph. View problem solving as a process of moving through a sequence of problem states.
This time: Outline Game playing The minimax algorithm
Computer Simulation (2) Game Playing. Different Types of Games How many players? –One –Two Element of chance? –Deterministic –Nondeterministic Outcome.
Game Playing CSC361 AI CSC361: Game Playing.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
MAE 552 – Heuristic Optimization Lecture 28 April 5, 2002 Topic:Chess Programs Utilizing Tree Searches.
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”
ICS-270a:Notes 5: 1 Notes 5: Game-Playing ICS 270a Winter 2003.
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
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.
CSC 412: AI Adversarial Search
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.
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.
Adversarial Search CS30 David Kauchak Spring 2015 Some material borrowed from : Sara Owsley Sood and others.
Game Playing.
Games CPS 170 Ron Parr. Why Study Games? Many human activities can be modeled as games –Negotiations –Bidding –TCP/IP –Military confrontations –Pursuit/Evasion.
 Summary  How to Play Go  Project Details  Demo  Results  Conclusions.
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.
Agents that can play multi-player games. Recall: Single-player, fully-observable, deterministic game agents An agent that plays Peg Solitaire involves.
Adversarial Search CS311 David Kauchak Spring 2013 Some material borrowed from : Sara Owsley Sood and others.
Mark Dunlop, Computer and Information Sciences, Strathclyde University 1 Algorithms & Complexity 5 Games Mark D Dunlop.
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.
Connect Four AI Robert Burns and Brett Crawford. Connect Four  A board with at least six rows and seven columns  Two players: one with red discs and.
Minimax with Alpha Beta Pruning The minimax algorithm is a way of finding an optimal move in a two player game. Alpha-beta pruning is a way of finding.
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.
CSCI 4310 Lecture 6: Adversarial Tree Search. Book Winston Chapter 6.
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.
Game tree search Chapter 6 (6.1 to 6.3 and 6.6) cover games. 6.6 covers state of the art game players in particular. 6.5 covers games that involve uncertainty.
Parallel Programming in Chess Simulations Tyler Patton.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
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.
Luca Weibel Honors Track: Competitive Programming & Problem Solving Partisan game theory.
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.
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.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
State Space 4 Chapter 4 Adversarial Games.
CSC 110 – Fluency in Information Technology Chess
David Kauchak CS52 – Spring 2016
NIM - a two person game n objects are in one pile
CSE (c) S. Tanimoto, 2001 Search-Introduction
Adversarial Search CS 171/271 (Chapter 6)
CS51A David Kauchak Spring 2019
CS51A David Kauchak Spring 2019
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

AI for Connect-4 (or other 2-player games) Minds and Machines

What Move to Make? Some strategies: – Random move – Random move in open column – Move in center column – Move in spot that wins (i.e. makes 4 out of 4) Move in spot that blocks opponent win – Move in spot that makes 3 (or 2 or 1) out of 4 (with rest open) Prevent opponent making such a move – Move in spot that is part of most possible 4-in-a-row – … ??

Looking Moves Ahead: Search Trees

Issue: Explosion of Possible Nodes Suppose that you and your opponent can choose between x different possible moves. – x is called the branching factor – for Connect-4, x is 7 (or less, once columns get filled up). Let’s say about 6 on average. So, you have x boards at level 1. For each move, there are x moves the opponents can make: x 2 boards at level 2 In general: x n boards at level n: an explosive function! For example, a typical game in Connect-4 may take 30 moves: that’s ~6 30 boards!

Chess, Combinatorial Explosion, and Computers It is estimated that the average number of moves that one can make during a chess game is about 30. Also, typical games of chess take about 80 moves. So, the search tree for chess would have about states which is about board states!! Deep Blue, the chess computer that beat Kasparov, was able to look about 8 moves ahead, which means that it would consider about 30 8, which is about (1 trillion), possible board positions. Deep Blue was able to do this because of its enormous speed.

Choosing Moves Current state AB Player 1’s turn: Player 1 wins!Player 2 wins!Still open Player 2’s turn: In other words: Player 1 can either make a ‘risky’ move (A) or a more ‘safe’ Move (B). Player 1 may be attracted to A, because if player 2 isn’t careful, player 1 wins. However, if player 2 is careful, player 1 will actually lose. So, what to do? Take the risk and hope that your opponent does something ‘stupid’, or play it safe?

The Max-Min Strategy One possible strategy in choosing moves is to assume that the opponent never does something stupid, and in fact always makes its best possible move The Max-Min strategy is based on this assumption: – Generate the search tree as far as you can – Now use some kind of scoring rubric to assign a score to the very last states: the better it is for player 1, the higher – Now work your way back up the tree, and score each of the earlier states as follows: If it is player 1’s turn, then the score is the maximum of the scores of the states immediately below it (i.e. pick best move for player 1) If it is player 2’s turn, then the score is the minimum of the scores of the states immediately below it (i.e. pick best move for player 2)

Example Max-Min Strategy x x o Tic-Tac-Toe: o to play x x o x x o oo x x o x x o oo x x x x o x x o oo xx Only some of the Branches are shown! x x o o x o o o x x o o x o x Score = 0 Pick max Pick min min = 0 max = 0 min = 0 Score = 1 max = 1 So pick this one! i.e. will lead to loss x x o o x o x Score = 0 min = 0

Search, Human Problem Solving, and Patterns It is unlikely that Kasparov contemplates 1 trillion board positions during every of his turns, and yet Kasparov can still play almost as good as Deep Blue. – So, either Kasparov uses some very powerful heuristics that drastically prune the search-tree, or Kasparov doesn’t use much search at all. Many cognitive scientists believe that we heavily rely on certain ‘patterns’ that tell us that ‘if you are in a situation that looks like this-or-that, then make such- and-so a move’. – For example, just a few of such ‘rules’ allow one to play perfect tic-tac-toe without doing any search at all. Some cognitive scientists estimate that someone like Kasparov has thousands of such abstract patterns stored in his brain.