MAE 552 – Heuristic Optimization Lecture 28 April 5, 2002 Topic:Chess Programs Utilizing Tree Searches.

Slides:



Advertisements
Similar presentations
Artificial Intelligence 5. Game Playing
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)
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
AI for Connect-4 (or other 2-player games) Minds and Machines.
Games & Adversarial Search
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.
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.
Hoe schaakt een computer? Arnold Meijster. Why study games? Fun Historically major subject in AI Interesting subject of study because they are hard Games.
Adversarial Search Chapter 6.
An Introduction to Artificial Intelligence Lecture VI: Adversarial Search (Games) Ramin Halavati In which we examine problems.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
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.
Chess AI’s, How do they work? Math Club 10/03/2011.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
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.
Lecture 5 Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
Brian Duddy.  Two players, X and Y, are playing a card game- goal is to find optimal strategy for X  X has red ace (A), black ace (A), and red two (2)
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.
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.
Agents that can play multi-player games. Recall: Single-player, fully-observable, deterministic game agents An agent that plays Peg Solitaire involves.
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.
Instructor: Vincent Conitzer
Game Playing. Towards Intelligence? Many researchers attacked “intelligent behavior” by looking to strategy games involving deep thought. Many researchers.
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.
Games 1 Alpha-Beta Example [-∞, +∞] Range of possible values Do DF-search until first leaf.
Chess and AI Group Members Abhishek Sugandhi Sanjeet Khaitan Gautam Solanki
Backtracking and Games Eric Roberts CS 106B January 28, 2013.
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.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
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.
How to play chess? By Mervyn George. The Rules of the Game White always move first White always move first You should always play touch a piece move a.
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
Artificial Intelligence
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
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.
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
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.
Game Playing Why do AI researchers study game playing?
Instructor: Vincent Conitzer
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Instructor: Vincent Conitzer
The Alpha-Beta Procedure
Instructor: Vincent Conitzer
Strategic Thinking There are two concepts that all chess players must understand from the start; strategy and tactics. Beginners often confuse the two.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

MAE 552 – Heuristic Optimization Lecture 28 April 5, 2002 Topic:Chess Programs Utilizing Tree Searches

The material in this lecture is from

Tree Searches as Applied to Chess Programs How can a computer play chess? For many people that is a mind-boggling concept. Chess seems like a distinctly human activity requiring intelligence and thought, so how can a computer possibly do it? Today we will talk about how efficient tree searches are vital to a successful chess program

Tree Searches as Applied to Chess Programs How does a computer play chess??? What you will find is that computers don't really "play" chess like people do. A computer that is playing chess is not "thinking.” It is calculating through a set of formulas that cause it to make good moves. As computers have gotten faster and faster, the quality of these calculated moves has gotten better and better.

Tree Searches as Applied to Chess Programs In 1997 a computer built by IBM, deep blue defeated Gary Kasparov the world champion is chess. Computers chess calculators are now the best chess players on the planet, even though they do it totally blindly!

How People Play Chess Computers chess calculators are now the best chess players on the planet, even though they do it totally blindly! If you have ever watched a person first learning to play chess, you know that a human chess player starts with very limited abilities. Once a player understands the basic rules that control each piece, he or she can "play" chess. However, the new player is not very good. Each early defeat comes as something of a surprise -- "Oh, I didn't think about that!" or "I didn't see that coming!" are common exclamations.

Tree Searches as Applied to Chess Programs The human mind absorbs these experiences, stores away different board configurations, discovers certain tricks and ploys, and generally soaks up the nuances of the game one move at a time. For a human being, therefore, the game of chess involves a great deal of high-level abstract thought -- visual pattern matching to recall board positions, rules and guidelines, conscious thought and even psychology! Computers do none of this... So how does a computer win at chess against the best human players???

Tree Searches as Applied to Chess Programs The current state-of-the-art in computer chess is fairly intricate, but all of it involves blind computation that is very simple at the core. Consider the start of game of chess….. Each player starts with 16 pieces Let's say that white starts. White has 20 possible moves: The white player can move any pawn forward one or two positions. (16 moves). The white player can move either knight in two different ways. (4 moves).

Initial Moves Possible for White Player RKBKiQBKR PPPPPPPP PPPPPPPP RKB QBKR

Tree Searches as Applied to Chess Programs The white player chooses one of those 20 moves and makes it. For the black player, the options are the same: 20 possible moves. So black chooses a move. Now white can move again. This next move depends on the first move that white chose to make, but there are about 20 or so moves white can make given the current board position, and then black has 20 or so moves it can make, and so on.

Tree Searches as Applied to Chess Programs This is how a computer looks at chess. It thinks about it in a world of "all possible moves," and it makes a big tree for all of those moves, like this:

Tree Searches as Applied to Chess Programs

Let us determine how many possible moves are represented on each level. Initially white has 20 possible moves to make. Black has 20 moves possible for each moves that white could make - 20*20=400 possible moves. Then white has about 20 moves for each move black could make - 20*20*20=8000 Then black has about 20 moves for each move black could make - 20*20*20*20=160,000

Tree Searches as Applied to Chess Programs If you were to fully develop the entire tree for all possible chess moves, the total number of board positions is about: 1,000,000,000,000,000,000,000,000, 000,000,000,000,000,000,000,000,000,000,000,00 0,000,000,000,000,000,000,000,000,000,000,000, 000,000,000,000,000, 000,000,000,000, or , give or take a few.

Tree Searches as Applied to Chess Programs That's a very big number. –Consider there have only been nanoseconds since the Big Bang. –There are thought to be only atoms in the entire universe. –When you consider that the Milky Way galaxy contains billions of suns, and there are billions of galaxies, you can see that that's a whole lot of atoms. –That number is dwarfed by the number of possible chess moves. Chess is a pretty intricate game!

Tree Searches as Applied to Chess Programs No computer is ever going to calculate the entire tree. What a chess computer tries to do is generate the board-position tree five or 10 or 20 moves into the future. Assuming that there are about 20 possible moves for any board position, a five-level tree contains 3,200,000 board positions. A 10-level tree contains about 10,000,000,000,000 (10 trillion) positions. The depth of the tree that a computer can calculate is controlled by the speed of the computer playing the game.

Tree Searches as Applied to Chess Programs Once it generates the tree, then the computer needs to "evaluate the board positions." That is, the computer has to look at the pieces on the board and decide whether that arrangement of pieces is "good" or "bad." The way it does this is by using an evaluation function. The simplest possible function might just count the number of pieces each side has. If the computer is playing white and a certain board position has 11 white pieces and nine black pieces, the simplest evaluation function might be: = 2

Tree Searches as Applied to Chess Programs Obviously, for chess that formula is way too simple, because some pieces are more valuable than others. So the formula might apply a weight to each type of piece Eval=w 1 *P 1 +w 2 *P 2 ……..etc.

Tree Searches as Applied to Chess Programs As the programmer thinks about it, he or she makes the evaluation function more and more complicated by adding things like: board position control of the center vulnerability of the king to check vulnerability of the opponent's queen and tons of other parameters. No matter how complicated the function gets, however, it is condensed down to a single number that represents the "goodness" of that board position.

Tree Searches as Applied to Chess Programs Consider the following situation. The diagram shows a three-level tree that looks three moves ahead and has evaluated the value of the final board positions.

Tree Searches as Applied to Chess Programs The values of each board position indicate the utility for the white player (the computer). In this tree, white can make three possible moves. From each of those three possible moves, black can make three possible moves. From each of those nine board positions, white can make two possible moves.

Tree Searches as Applied to Chess Programs To decide what to do, the computer looks at this tree and works upward from the bottom. Its calculations are set up so that it finds the best board positions from each of the possible positions black will take (it takes the maximum):

Tree Searches as Applied to Chess Programs One level up, it assumes that black will choose the worst possible position for white (it takes the minimum):

Tree Searches as Applied to Chess Programs Finally, it takes the maximum of the top three numbers: 7. That is the move the computer will make. Once black makes its move, the computer goes through this whole process again, generating a new tree and evaluating all of the board positions to figure out its next move.

Tree Searches as Applied to Chess Programs In theory, the minimax algorithm allows one to play "perfect" chess; that is, the player always makes a winning move in a won position or a drawing move in a drawn position. Unfortunately, it is impossible to search the entire tree in a reasonable amount of time The computer can generally on look 5-10 moves ahead.

Tree Searches as Applied to Chess Programs Normally a variant of the A * algorithm is used to search the tree - the best potential moves are examined first. A method call alpha-beta pruning is used to reduce the size of the tree by getting rid of branches that are sub-optimal This can speed the search to a particular depth by as much as 50%. This is increase the number of moves a computer can look ahead.