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.

Slides:



Advertisements
Similar presentations
W 2 L 1 sh 1 Assignments Read the ‘overzicht’ document! OnderwerpV2CCPP1 x y x = student nummer y = nummer.
Advertisements

Martin Boyd Christopher Hirunthanakorn
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.
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.
Game Playing Games require different search procedures. Basically they are based on generate and test philosophy. At one end, generator generates entire.
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
Application of Artificial intelligence to Chess Playing Capstone Design Project 2004 Jason Cook Bitboards  Bitboards are 64 bit unsigned integers, with.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Artificial Intelligence in Game Design Heuristics and Other Ideas in Board Games.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
Artificial Intelligence in Game Design
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
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
Computer Simulation (2) Game Playing. Different Types of Games How many players? –One –Two Element of chance? –Deterministic –Nondeterministic Outcome.
MAE 552 – Heuristic Optimization Lecture 28 April 5, 2002 Topic:Chess Programs Utilizing Tree Searches.
How computers play games with you CS161, Spring ‘03 Nathan Sturtevant.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Games Search Neil Heffernan Some of these slides are screen shots from the the slides my professor at CMU (Andrew Moore) used. (Sorry for the low resolution)
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Othello.
Game Tree Search based on Russ Greiner and Jean-Claude Latombe’s notes.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
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.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
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.
Artificial Intelligence in Game Design Lecture 22: Heuristics and Other Ideas in Board Games.
Othello Artificial Intelligence With Machine Learning
W 1 L 2 sh 1 C lessons LessonSubjectBook Week 1 lesson 1Objects, names Week 1 lesson 2Statements, layout Week 2 lesson 1Functions, decomposition Week 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.
Investigation #1 Factors and Products.
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.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Recursion Alice. Repetition In some situations, we don’t know exactly how many times a block of instructions should be repeated. All we know is that repetition.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
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.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW AI for games: min-max search COMP #
Rules Of Chess!!!!!! By: Caylin Stappenbeck. Table Of Contents!!!! Rules*** Conclusion***
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 Thanks to Andrew Moore and Faheim Bacchus for slides!
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.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Othello Artificial Intelligence With Machine Learning Computer Systems TJHSST Nick Sidawy.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Adversarial Search. Regular Tic Tac Toe Play a few games. –What is the expected outcome –What kinds of moves “guarantee” that?
CompSci Recursion & Minimax Recursion & the Minimax Algorithm Key to Acing Computer Science If you understand everything, ace your computer science.
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.
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.
David Kauchak CS52 – Spring 2016
Dakota Ewigman Jacob Zimmermann
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Kevin Mason Michael Suggs
The Alpha-Beta Procedure
Game Playing Fifth Lecture 2019/4/11.
CS51A David Kauchak Spring 2019
Presentation transcript:

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 lesson 2Recursion, minimax Week 3 lesson 1Memory, testing Week 3 lesson 2Fagan inspection

W 2 L 1 sh 2 Recursion A function can call itself unsigned int add( unsigned int a, unsigned int b ){ if( b == 0 ){ return a ); } return add( ++a, --b ); } Useful recursion must n Have a terminating condition n Recurse to a simpler case (nearer to the terminating condition)

W 2 L 1 sh 3 Recursion – rewrite? One-point recursion can always be rewritten as a loop unsigned int add( unsigned int a, unsigned int b ){ while( b != 0 ){ a++; b--; } return a; } Multi-point recursion (in general) can not int lagest( node * node ){ int result = – MAXINT; if( node != NULL ){ result = maximum( result, node->value )); result = maximum( result, largest( node->left )); result = maximum( result, largest( node->right )); } return result; }

W 2 L 1 sh 4 Recursion – watch out for the stack! void flood_fill( int x, int y, int original, int fill ){ if( ! in_bounds( x, y ){ return; }; flood_fill_flood( x, y - 1, original, fill ); flood_fill_flood( x, y + 1, original, fill ); flood_fill_flood( x - 1, y, original, fill ); flood_fill_flood( x + 1, y, original, fill ); } The DS screen is (only) 256x192. I had to limit the recursion depth to < Note: 2200 still crashes on the real NDS 

W 2 L 1 sh 5 Game theory: minimax In a Which move should I select? Move 1; then my opponent can select Move 1.1 : I lose Move 1.2 : I win Move 2; then my opponent can select Move 2.1 : draw Move 2.2 : draw You opponent should minimize your result, from those minimums you should select the maximum.

W 2 L 1 sh 6 Recursive minimax int minimax( board b, side s ){ int result = worse than all possible results for s; for( all allowed moves m for side s ){ b1 = make_move( b, m ); outcome = minimax( b1, !s ); if( outcome is better for me than current result ){ result = outcome; } return result; } What is missing?

W 2 L 1 sh 7 Recursive minimax int minimax( board b, side s, int depth ){ if( depth int result = worse than all possible results for s; for( all allowed moves m for side s ){ b1 = make_move( b, m ); outcome = minimax( b1, !s, depth - 1 ); if( outcome is better for me than current result ){ result = outcome; } return result; }

W 2 L 1 sh 8 Branching factor A move by one side is often called a ply. A move from by one side, followed by a move by the other side is called a full move. The number of possible moves by one side is called the branching factor. The branching factor determines how deep you can evaluate. Why?

W 2 L 1 sh 9 Typical branching factors GameTypical branching factor Tic-Tac-Toe4 Connect-46 Reversi8 Checkers10 Chess40 Go300 Humans are very good at evaluation only ‘good’ moves to a reasonable depth. Computers mainly rely on speed to evaluate (and remember) all moves (brute force method).

W 2 L 1 sh 10 Reversi board evaluation I see a situation on the board. How good its it for me? n When neither side can move, count the pieces, decide whether it is a draw, win, or loss. n Otherwise …. n Count the pieces n Mobility: the number of moves I can choose from n Preferred fields: n Corners are very good n Next-to-corner is very bad (unless you have the corner) n Other border fields are moderately good n Other next-to-border fields are moderately bad

W 2 L 1 sh 11 Reversi application week-2-2.zip  Complete application  Two nearly identical projects: PC and NDS  Each side can be man or machine  NDS version is ‘better’ for a human player (GUI)  PC version is faster (better for machine-versus- machine)

W 2 L 1 sh 12 Reversi application - evaluators int evaluate_mobility( board b, int color ){ return reversi_board_n_moves( b, color ); } int evaluate_count( board b, int color ){ return reversi_board_count_color( b, color ) - reversi_board_count_color( b, reversi_opponent( color )); }

W 2 L 1 sh 13 Reversi application - main void show( board b, int color ){ reversi_board_print_lcd( b, color ); int i; for( i =0 ; i < 10; i++ ){ swiWaitForVBlank(); } int main( void ){ console_init_top(); (void) play_game( evaluate_mobility, 2, evaluate_count, 2, 1, show ); return 0; } void show( board b, int color ){} int main(int argc, char *argv[]){ (void) play_game( evaluate_mobility, 4, evaluate_count, 4, 1, show ); system( "PAUSE" ); return 0; }

W 2 L 1 sh 14 Assignment – for each V2TH05 group (1) Imagine that we are planning to write a reversi application. As part of the preparation phase we need some data. I want a short report (1-4 pages) with answers to the following questions:  How do the two evaluators score against each other (at various evaluation depths)?  Add a weighted-fields based evaluator and compare its performance against the other two.  Evaluate the playing strength of one group member against various evaluators at various evaluation depths.

W 2 L 1 sh 15 Assignment – for each V2TH05 group (2)  What is the speed factor between the NDS and a PC when running machine-against-machine? (Check the code, don’t put the NDS at a disadvantage!)  The current application is deterministic: each run is the same. This makes it impossible to average a number of games to get a good idea of the strength of two evaluators How can this be changed? (Multiple answers possible. You don’t need to do it, imagine that you are pointing a colleague in the right direction).  Try your weighted-fields evaluator against (at least) one other group.

W 2 L 1 sh 16 Assignment – for each V2TH05 group (3) Requirements for the document: 1. Either Dutch or English (but use only one language!). 2. Readable, no SMS or telegram style. 3. All questions must be answered and (when applicable) motivated. 4. Explain your weighted-fields evaluator.