AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5  Matchstick Games -

Slides:



Advertisements
Similar presentations
AE1APS Algorithmic Problem Solving John Drake.  Coursework 3 due on Thursday at 1pm  (i.e. before the start of the tutorial).  Submit either hard-copy.
Advertisements

ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10.
AE1APS Algorithmic Problem Solving John Drake
AE1APS Algorithmic Problem Solving John Drake
Martin Boyd Christopher Hirunthanakorn
Introduction to Combinatorial Game Acm Honored Class Weitao.
Evolution and Repeated Games D. Fudenberg (Harvard) E. Maskin (IAS, Princeton)
Game Theory An Overview of Game Theory by Kian Mirjalali.
Place captured red pieces below Place captured blue pieces below Rules New Game Exit Left mouse click on piece – drag to desired location - left mouse.
4 Games and Fuses U:\APPS\Ghostgum\gsview Shared folder U:\2nd Year Share\Computer Science Courses\Semester One\Algortithmic Problem Solving Book: Algorithmic.
Tutorial 6 of CSCI2110 Bipartite Matching Tutor: Zhou Hong ( 周宏 )
AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5 (13) ◦ Knights and Knaves.
AE1APS Algorithmic Problem Solving John Drake..  Previously we introduced matchstick games, using one pile of matches  It is possible to have more than.
Progressively Finite Games
SCIT1003 Chapter 2: Sequential games - perfect information extensive form Prof. Tsang.
Unit 7: Chance Variation. Repeating with Excel Two EV’s and two SE’s Suppose we know the box (model) of a game, and we make many draws from the box with.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
The Game of Nim on Graphs: NimG Gwendolyn Stockman Alan Frieze and Juan Vera.
Probability And Expected Value ————————————
Graphs, relations and matrices
Matthew Marcon Project 19 1/10/12
Salvador Badillo-Rios and Verenice Mojica. Goal The goal of this research project was to provide an extended analysis of 2-D Chomp using computational.
- ABHRA DASGUPTA Solving Adhoc and Math related problems.
A Storyteller’s Tale Many years ago, wandering storytellers travelled from village to village telling stories in exchange for food, shelter, and money.
Kim Moore, Program Manager Dr. Tonya Jeffery, Co-PI.
Algebraic Structures: An Activities Based Course MATH 276 UWM MATH 276 UWM.
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)
Investigation #1 Factors (Factor Game).
Investigation #1 (cont.)
Part II - Sums of Games Consider a game called Boxing Match which was defined in a programming contest m.short.html.
Investigation #1 Factors and Products.
Catch the Spirit of Mathematical Practices Mathematics Investigations Q-Cards: Rational Numbers The Q-Card game has 8 starter cards, 28 playing cards,
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.
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.
1 CO Games Development 1 Week 11 Search Methods Gareth Bellaby.
Dynamic Games & The Extensive Form
6 Sums of Games.. Lecture6 Admin Plagiarism forms Answer football cup final problem. //Daisy Problem hints e.g. try a smaller size. General problem solving.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
How to Play Checkers This presentation is a tutorial on how to play on of the oldest and most popular games in history. Presented By: Cathryn Depuy Project.
A Classic Game of Strategy for the 21 st Century.
Investigation #1 (cont.) Products and Multiples. 1.3 The Product Game.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Lesson 10.6a AIM: Variations on Linear Nim. DO NOW.
An Introduction to Game Theory Math 480: Mathematics Seminar Dr. Sylvester.
Bell Ringers Solve the following equations and write the commutative property equation and solve: (-74) + 54 (-87) + (-32) Solve the following equations.
Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board.
Multiples and Factors. Multiples A multiple is a number that is in the times tables. A multiple is a number that is in the times tables. Multiples of.
Year 9 Proof Dr J Frost Last modified: 19 th February 2015 Objectives: Understand what is meant by a proof, and examples.
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Picking Apples. Subtraction game. Turn over two cards from 0-10 Work out the difference. If you have an apple with this amount put a counter on it. First.
The Lovely Game of NIM. Version 1 - Classic NIM You will need seven objects, such as counters or blocks. It is a game for two players. Place the 7 counters.
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.
Lecture Coursework 2. Rectangle Game Look at proof of matchsticks Read thru the question. A rectangular board is divided into m columns by n rows. The.
Patrick Racy Project 19 1/9/12
Topic 3 Exponents.  Each group is responsible a block of problems  Find the answers  Draw the matching picture on the poster.  If you notice a mistake.
K 3 -Saturator By Roy Oursler. What is K 3 -Saturator K 3 -Saturator is a combinatorial game A combinatorial game is a two player game where both of the.
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.
Content Game of Nim Impartial Games Sprague-Grundy theorem
Algebra 2 Properties of Real Numbers Lesson 1-2 Goals Goal To graph and order real numbers. To Identity properties of real numbers. Rubric Level 1 –
Adversarial Search and Game-Playing
Introductory Game Theory
Recitation #3 Tel Aviv University 2016/2017 Slava Novgorodov
SCIT1003 Chapter 2: Sequential games - perfect information extensive form Prof. Tsang.
Chapter 4-1 Terminology and rules Node Voltage Review Matrix
NIM - a two person game n objects are in one pile
Strike it out.
Team Dont Block Me, National Taiwan University
Try starting with fewer objects to investigate.
Game Theory Day 2: More Simple Games.
Presentation transcript:

AE1APS Algorithmic Problem Solving John Drake

 Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5  Matchstick Games - Chapter 4 ◦ Matchstick Games – Winning Strategies ◦ Subtraction-set Games  Sum Games – Chapter 4  Induction – Chapter 6  Tower of Hanoi – Chapter 8

 The goal is to have some method (i.e. algorithm) do decide what to do next so that the eventual outcome is a win  The key to winning is to recognise the invariants  Remember - An invariant is something that does not change

 We will work with matchstick games  We identify winning and losing positions in a game  A winning strategy is therefore maintaining an invariant

 Played with one or more piles of matches  Two players make alternate moves  A player can remove one or more matches from one of the piles, according to a given rule  The game ends when there are no more matches to be removed  The player who cannot take any matches is the loser, i.e. the player who took the last match(es) is the winner

 This is an impartial, two person game with complete information.  Impartial means rules for moving apply the same to both players.  Complete information means that both players have complete information about the game i.e. they know the complete state of the game.  An impartial game that is guaranteed to terminate, it is always possible to characterise the positions as winning or losing positions.

 A winning position is one from which we can assure a win.  A losing position is one from which we can never win.  A winning strategy is an algorithm for choosing moves from winning positions that guarantees a win (i.e. we maintain an invariant).

 Suppose there is one pile of matches, and a player can remove either 1 or 2 matches  How do we identify winning and losing positions?

 Draw a state transition diagram (p.70)  Nodes are labelled with the number of matches remaining  Edges define the transition of state when a number of matches removed on that turn  We can now label the nodes as winning or losing

 A node is winning if there is an edge to a losing position  A node is losing if every edge from the node leads to a winning node (i.e. we cannot escape from the losing situation)

 Node 0 is losing, as there are no edges from it  Nodes 1 and 2 are winning, as there is an edge to node 0  Node 3 is losing, as both edges from 3 are to nodes 1 and 2 which are already labelled as winning  A clear pattern emerges; losing positions are where the number of matches is a multiple of 3

 Beginning from a state in which n is a multiple of 3, and making and arbitrary move, results in a state in which n is not a multiple of 3. Thus removing n mod 3 matches results in a state in which n is again a multiple of 3. NB: Only labelled to 7

 The terminology we use to describe the winning strategy is to maintain invariant property that the number of matches remaining is a multiple of 3

 If both players are perfect, the winner is decided by the starting position. If the starting position is a losing position, the second player is guaranteed to win. Starting from a losing position, you can only hope that your opponent makes a mistake, and puts you in a winning position.

 Some variations on the matchstick game:  There is one pile of matches, each player is allowed to remove 1, 3, 4 matches  There is one pile of matches, each player is allowed to remove 1, 3, 4 matches, except that you are not allowed to repeat the last move. So if you opponent removes 1 match you must remove 3 or 4.  What are the winning positions and what are the winning strategies.?

 What are the winning positions and what are the winning strategies?  {1, 3, 4} Subtraction subset  We can remove 1 or 3 or 4 matches.

 Calculate the remainder r after dividing by 7 i.e. mod 7  If r is 0 or 2, the position is a losing position. Otherwise it is a winning position.  The winning strategy is to remove 1 match if r=1,  Remove 3 matches if r=3 or r=5, remove 4 matches if r = 4 or r =6.

 Suppose a daisy (a flower) has 16 petals arranged symmetrically around its centre. Two players take it in turns to remove petals. A move means taking one petal or two adjacent petals. The winner is the person who removes the last petal. Who should win and what is the winning strategy.