4 Games and Fuses U:\APPS\Ghostgum\gsview Shared folder U:\2nd Year Share\Computer Science Courses\Semester One\Algortithmic Problem Solving Book: Algorithmic.

Slides:



Advertisements
Similar presentations
AE1APS Algorithmic Problem Solving John Drake
Advertisements

Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Probability, Part 1 We’ve looked at several counting techniques to determine the number of possible arrangements or groupings in a given scenario. These.
COUNTING AND PROBABILITY
Game Theory An Overview of Game Theory by Kian Mirjalali.
AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5  Matchstick Games -
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
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
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
Domineering Solving Large Combinatorial Search Spaces.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
Tirgul 10 Rehearsal about Universal Hashing Solving two problems from theoretical exercises: –T2 q. 1 –T3 q. 2.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
Graphs, relations and matrices
Copyright © Cengage Learning. All rights reserved. CHAPTER Right Triangle Trigonometry Right Triangle Trigonometry 2.
Test Preparation Strategies
Algebra Problems… Solutions
State-Space Searches.
NCTM Conference April  Domain: Operations & Algebraic ThinkingOperations & Algebraic Thinking  K.OA.3  Decompose numbers less than or equal to.
Recall that a square matrix is one in which there are the same amount of rows as columns. A square matrix must exist in order to evaluate a determinant.
- ABHRA DASGUPTA Solving Adhoc and Math related problems.
1 Year 10 Revision Notes. 2 Revision List 1.Types of Number11. 3-d Shapes 2.Rounding12. Volume 3.Time13. Symmetry 4.The Calendar14. Angles 5.Negative.
A Storyteller’s Tale Many years ago, wandering storytellers travelled from village to village telling stories in exchange for food, shelter, and money.
Towers of Hanoi. Introduction This problem is discussed in many maths texts, And in computer science an AI as an illustration of recursion and problem.
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)
APS various problems. Not all bit-strings are compressible. If we have a bit string length n, sometimes we can compress it to a shorter bit string! Here.
Final Lecture. Instructions in Exam ANSWER 2 QUESTIONS. There will be a choice of 3 questions. Each question will be in parts e.g. a, b, c. You can see.
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.
1 CO Games Development 1 Week 11 Search Methods Gareth Bellaby.
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.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Copyright © Cengage Learning. All rights reserved. CHAPTER 7 FUNCTIONS.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Counting Techniques and Some Other Math Team Strategies Susan Schwartz Wildstrom Walt Whitman High School Bethesda, MD NCTM National Meeting April 6, 2001.
2. Regular Expressions and Automata 2007 년 3 월 31 일 인공지능 연구실 이경택 Text: Speech and Language Processing Page.33 ~ 56.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
March 23 & 28, Hashing. 2 What is Hashing? A Hash function is a function h(K) which transforms a key K into an address. Hashing is like indexing.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Year 3 Block A. 3A1 I can solve number problems and practical problems involving place value and rounding. I can apply partitioning related to place value.
Mental Maths at St John’s. How Maths teaching has changed -To give children the chance to explore ways of finding an answer, and being able to explain.
Analyzing Puzzles and Games. What is the minimum number of moves required to complete this puzzle?
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
An Introduction to Game Theory Math 480: Mathematics Seminar Dr. Sylvester.
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.
Basic Facts Middle Focus Group Raewyn Carman & Dianne Ogle 24 November 2010.
Year 9 Proof Dr J Frost Last modified: 19 th February 2015 Objectives: Understand what is meant by a proof, and examples.
Bell Work Please write the fraction, decimal AND percent. 1)Convert 4/5 to a decimal and a percent. 1)Convert.675 to a fraction and a Percent. 1)Convert.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
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.
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.
Chance We will base on the frequency theory to study chances (or probability).
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.
Strategies & Knowledge for Independent Learning individual Work SKIL SKIL cards are sets of cards that explain how to use different learning strategies.
Comparative Relational Thinking
Content Game of Nim Impartial Games Sprague-Grundy theorem
Maths Year 2 Autumn 1: Numbers within 100; Add and subtract 2-digit and 3-digit numbers Autumn 2: Addition and subtraction problems; Multiplication and.
KS1 Maths at Tregolls.
Adversarial Search and Game-Playing
Year 2 Block A.
Games Workshop.
KS3 Mathematics A5 Functions and graphs
Counting Techniques and Some Other Math Team Strategies
Welcome to our Early years and KS1 maths workshop
Presentation transcript:

4 Games and Fuses U:\APPS\Ghostgum\gsview Shared folder U:\2nd Year Share\Computer Science Courses\Semester One\Algortithmic Problem Solving Book: Algorithmic Problem Solving by Roland Backhouse. Other books: any puzzle book or you can Google logic puzzles, problems, brainteasers, conundrums. Or search for the content of the problems e.g. river crossing problems. Office hour Tue , Fri Office AB 325. If you have any “nice” problems please let me have them. Any questions, please ask me?

FUSE CLOCKS A fuse is lit at one end and will burn for a specific amount of time i.e. n minutes. The rate at which a fuse burns is irregular i.e. it cannot be lit in the middle with any confidence that the amount of time taken to burn will be half. Two n minute fuses both take n minutes to burn, so the average rate is the same. But at any moment the instantaneous rates may differ. A fuse is a length of wire which take a certain amount of time to burn along its length, not to be confused with an electrical fuse which is thin and burns out if too many amps flow thought it.

Example With a single n minute fuse, we could light it at one end and it would take n minutes to burn. Alternatively we could light it at both ends simultaneously and it would take n/2 minutes to burn. Also, given two fuses, we can light the simultaneous so that they are burning together, or light one after the other (i.e. we can burn fuses in serial or partially in parallel). This way we can create new time periods. Imagine we have 2 60 minute fuses. How can we build a 45 minute fuse?

Solution Solution. Light the first fuse at one end and the second fuse at both ends. When the second fuse has burnt out, light the other end of the first fuse. When this has burnt out it makes a total of 45 minutes.

How many How many other clocks can you make with a pair of fuses? Remember you cannot have a negative time period (e.g. you can burn two fuses in parallel lighting the ends at the same time, giving n-m minutes but we assume this is a positive number). Clocks can be constructed by starting one clock after another, starting two clocks together but starting the timing when one clock has completed. We can also halve the time of a clock by lighting it at both ends. These three construction techniques correspond to addition, subtraction and halving of times.

HOURCLASS CLOCKS An hour glass is a glass timer which contains sand. The sand runs under gravity from one end to the other. Unlike a fuse it can be reused (i.e. it can be turned upside down at any point). In this game you are given 2 hourglasses one of 7 minutes and the other of 11 minutes. Your task is to use these 2 hourglasses to measure times of 15 minutes and 24 minutes. Can you do that?

Simple two player games. The goal is to have some method (i.e. algorithm) do decide what to do next. The key to winning is to recognise the invariants. We introduce a number of matchstick games. We identify winning and losing positions in a game. A winning strategy is therefore maintaining an invariant.

Matchstick Games. 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 lasts matches is the winner.

Terminology 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.

Winning and Losing Moves 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).

Identify Positions Suppose there is one pile of matches, and you can remove 1 or 2 matches. How do we identify winning and losing positions? The losing positions are a multiple of 3. The remaining positions are winning positions.

Some Variations Some variations on the matchstick game. There is one pile of matches, each player is allowed to remove 1, 3, 4 matches. What are the winning positions and what are the winning strategies. 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.

winning strategies Draw a state transition diagram p44 Nodes are labelled with the number of matches remaining. Edges are labelled with the number of matches removed on that turn. We can now label the nodes as winning or losing.

State Diagram 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). Note that this seems like a circular definition 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. Draw thick lines indicating winning positions and winning moves. P45 A clear pattern emerges; losing positions are where the number of matches is a multiple of 3.

Winning Strategy 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.

Initial Situation 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. Think of the situation is OXO.

Formally The terminology we use to describe the winning strategy is to “maintain invariant” property that the number of matches is a multiple of 3. Formally we can write this as (the number of moves remaining before the game ends is even) equals (the position is a losing position) I.e. we alternate between winning and losing states or positions.

Subtraction Subset {1, 3, 4} Subtraction subset Now we can remove 1 or 3 or 4 matches. Go thru the process of labelling states as winning or losing and build up the table on page 49. Draw the diagram.

Winning Strategy Calculate the remainder r after dividing by 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.

The Daisy Problem. Suppose a daisy (a flower) has 16 petals arranged symmetrically around its center. 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.

The Coin Problem. Two players have an unlimited supply of circular coins of varying diameter (both players have the same set of coins). The players take it in turn to place a coin on a rectangular table, such that it does not overlap any coins already on the table and does not overhang. The winner is the one who puts the last coin on the table. Who should win and what is the winning strategy?

EXPLORER 1 An explorer walk one mile south, one mile east and one mile north, but find that he has returned to the point where he started. Why is this? Where was he standing?

Explorer 2 The point of this problem is that we may find one solution then stop, but in fact there is an infinite set of solutions. Also ask why it is colder at the poles than at the equator (there are two reasons at least1. further away, 2, light glances 3 light has further to travel thru the atmosphere.)

COLOURING THE FACES OF A CUBE Colouring cubes How many different ways are there to colour a cube. I think there are too many just to count, so you need a more principled way to get the solution.