Part II - Sums of Games Consider a game called Boxing Match which was defined in a programming contest m.short.html.

Slides:



Advertisements
Similar presentations
Extensible Networking Platform CSE 240 – Logic and Discrete Mathematics Review: Mathematical Induction Use induction to prove that the sum of the.
Advertisements

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.
CPSC 121: Models of Computation Unit 6 Rewriting Predicate Logic Statements Based on slides by Patrice Belleville and Steve Wolfman.
Introduction to Combinatorial Game Acm Honored Class Weitao.
AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5  Matchstick Games -
Recursively Defined Functions
4 Games and Fuses U:\APPS\Ghostgum\gsview Shared folder U:\2nd Year Share\Computer Science Courses\Semester One\Algortithmic Problem Solving Book: Algorithmic.
Induction.
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
Math 344 Winter 07 Group Theory Part 3: Quotient Groups
New Toads and Frogs Results By Jeff Erickson Presented by Nate Swanson.
II. Linear Independence 1.Definition and Examples.
1.  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering.
The Game of Nim on Graphs: NimG Gwendolyn Stockman Alan Frieze and Juan Vera.
CSE115/ENGR160 Discrete Mathematics 02/07/12
The Game of Nim on Graphs: NimG By Gwendolyn Stockman With: Alan Frieze, and Juan Vera.
Adversarial Search: Game Playing Reading: Chess paper.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Using Reduction for the Game of NIM. At each turn, a player chooses one pile and removes some sticks. The player who takes the last stick wins. Problem:
MATRICES. Matrices A matrix is a rectangular array of objects (usually numbers) arranged in m horizontal rows and n vertical columns. A matrix with m.
Games, Hats, and Codes Mira Bernstein Wellesley College SUMS 2005.
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas in Computer Science.
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.
Based on slides by Patrice Belleville and Steve Wolfman CPSC 121: Models of Computation Unit 9b: Mathematical Induction - part 2.
Ch. 8 & 9 – Linear Sorting and Order Statistics What do you trade for speed?
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Introduction to Proofs
Introduction to Proofs
A few leftover Decrease-and-conquer Algorithms
Impartial Games, Nim, Composite Games, Optimal Play in Impartial games
Agents that can play multi-player games. Recall: Single-player, fully-observable, deterministic game agents An agent that plays Peg Solitaire involves.
Section 1.8. Section Summary Proof by Cases Existence Proofs Constructive Nonconstructive Disproof by Counterexample Nonexistence Proofs Uniqueness Proofs.
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
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.
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.
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
Dominance Since Player I is maximizing her security level, she prefers “large” payoffs. If one row is smaller (element- wise) than another,
Amazons Experiments in Computer Amazons, Martin Mueller and Theodore Tegos, 2002 Exhaustive Search in the Game Amazons Raymond Georg Snatzke, 2002 Presented.
5.2 Trees  A tree is a connected graph without any cycles.
Crystal Bennett Joshua Chukwuka Advisor: Dr. K. Berg.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
A game based off of the esteemed classic By: Tadziu Kosiara.
An Introduction to Game Theory Math 480: Mathematics Seminar Dr. Sylvester.
Algebraic Structure in a Family of Nim-like Arrays Lowell Abrams The George Washington University Dena Cowen-Morton Xavier University TexPoint fonts used.
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
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.
Game tree search Thanks to Andrew Moore and Faheim Bacchus for slides!
Year 9 Proof Dr J Frost Last modified: 19 th February 2015 Objectives: Understand what is meant by a proof, and examples.
Introduction to State Space Search
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
Coin Turning Games By: Lauren Quattrocchi. What are Coin Turning Games? -Coin turning games are a class of combinatorial games in which there are a finite.
Transfinite Chomp Scott Huddleston and Jerry Shurman Presented by Ehren Winterhof.
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.
Benjamin Casey C S 329 E Spring  Variants played since ancient times; resemblance to Chinese “Jianshizi” or “picking stones”  Current name and.
C&O 355 Lecture 19 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A A A A.
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
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.
拉丁方陣 交大應數系 蔡奕正. Definition A Latin square of order n with entries from an n-set X is an n * n array L in which every cell contains an element of X such.
Content Game of Nim Impartial Games Sprague-Grundy theorem
Strong Induction: Selected Exercises Goal Explain & illustrate proof construction of a variety of theorems using strong induction.
Some more Decrease-and-conquer Algorithms
Introductory Game Theory
Great Theoretical Ideas in Computer Science
Christopher Hodgson and Gregory Tyler Loftis
The Alpha-Beta Procedure
Breakfast Bytes Easy, Hard, and Impossible
Daniel Graff Seminar über Algorithmen
Presentation transcript:

Part II - Sums of Games Consider a game called Boxing Match which was defined in a programming contest m.short.html An n x m rectangular board is initialized with 0 or 1 stone on each cell. Players alternate removing all the stones in any square subarray where all the cells are full. The player taking the last stone wins.

Boxing Match Example Suppose we start with a 10 x 20 array that is completely full. Is this a P or an N-position?

Example Contd. The 10 x 20 full board is an N-position. A winning move is to take a 10x10 square in the middle. This leaves a 5x10 rectangle on the left and a 5x10 rectangle on the right. This is a P-position via mirroring. QED.

Sums of Games xxxxxxx xxxxxxxxxx xxxxxxx xxxxxxxxxx xxxxxxx xxxxxxxx xxxxxxxxx xxxxxxxxxxxx xxxxxx xxx Empty Column Arbitrary stuff

In this kind of situation, the left and right games are completely independent games that don’t interact at all. This naturally leads to the notion of the sum of two games. A + B

A and B are games. The game A+B is a new game where the allowed moves are to pick one of the two games A or B (that is non-terminal) and make a move in that game. The position is terminal iff both A and B are terminal. The sum operator is commutative and associative (explain).

Sums of Games* We assign a number to any position in any game. This number is called the Nimber of the game. (It’s also called the “Nim Sum” or the “Sprague-Grundy” number of a game. But we’ll call it the Nimber.) *Only applies to normal, impartial games.

The MEX The “MEX” of a finite set of natural numbers is the Minimum EXcluded element. MEX {0, 1, 2, 4, 5, 6} = MEX {1, 3, 5, 7, 9} = 3 0 MEX {} = 0

Definition of Nimber The Nimber of a game G (dnoted N(G)) is defined inductively as follows: N(G) = MEX{N(G 1 ), N(G 2 ), … N(G n )} Where G 1, G 2, … G n are the successor positions of game G. (I.e. the positions resulting from all the allowed moves.) N(G) = 0 if G is terminal

Another look at Nim Let P k denote the game that is a pile of k stones in the game of Nim. Theorem: N(P k ) = k

Proof: Use induction. Base case is when k=0. Trivial. When k>0 the set of moves is P k-1, P k-2, … P 0. By induction these positions have nimbers k-1, k-2, … 0. The MEX of these is k. QED.

(i.e. Nimber = 0 iff P-position) Theorem: A game G is a P-position if and only if N(G)=0. Proof: Induction. Trivially true if G is a terminal position. If N(G)≠0, then by the MEX rule there must be a move G’ in G that has N(G’)=0. By induction this is a P-position. Thus G is an N position. Suppose G is non-terminal.

If N(G)=0, then by the MEX rule none of the successors of G have N(G’)=0. By induction all of them are N-positions. Therefore G is a P-position. QED. Nimber = 0 iff P-position (contd)

The Nimber Theorem Theorem: Let A and B be two impartial normal games. Then: N(A+B) = N(A)  N(B) Proof: We’ll get to this in a minute.

The beauty of Nimbers is that they completely capture what you need to know about a game in order to add it to another game. This often allows you to compute winning strategies, and can speed up game search exponentially. The beauty of Nimbers is that they completely capture what you need to know about a game in order to add it to another game. This often allows you to compute winning strategies, and can speed up game search exponentially.

Application to Nim Note that the game of Nim is just the sum of several games. If the piles are of size a, b, and c, then the nim game for these piles is just P a + P b + P c. The nimber of this position, by the Nimber Theorem, is just a  b  c. So it’s a P-position if and only if a  b  c=0, which is what we proved before.

Application to Chomp

+ What if we add this to a nim pile of size 4? If we remove two chips from the nim pile, then the nimber is 0, giving a P-position. This is the unique winning move in this position. 4  2 = 6 Is this an N-position or a P-position? N() ≠ 0  it’s an N-position. How do you win?

Proof of the Nimber Theorem: N(A+B) = N(A)  N(B) Let the moves in A be A1, A2, …, An And the moves in B be B1, B2, …, Bm The moves in A+B are: A+B1, A+B2, … A+Bm, A1+B, … An+B A+B1, A+B2, … A+Bm, A1+B, … An+B We use induction. If either of these lists is empty the theorem is trivial (base case)

N(A+B) = MEX{N(A+B1),…N(A+Bm), N(A1+B),…N(An+B)} N(A1+B),…N(An+B)} N(A+B) = (by induction) MEX{N(A)B1),…, N(A)Bm), MEX{N(A)  N(B1),…, N(A)  N(Bm), N(A1)B),…, N(An)B) } N(A1)  N(B),…, N(An)  N(B) } How do we prove this is N(A) How do we prove this is N(A)  N(B)? We do it by proving two things: (1) N(A) (1) N(A)  N(B) is not in the list (2) For all y < N(A) (2) For all y < N(A)  N(B), y is in the list

MEX{N(A)B1),…, N(A)Bm), MEX{N(A)  N(B1),…, N(A)  N(Bm), N(A1)B),…, N(An)B) } N(A1)  N(B),…, N(An)  N(B) } Why is N(A)B) not in this list? Why is N(A)  N(B) not in this list? Because N(Bi) ≠ N(B)  N(A)Bi) ≠ N(A)B) N(Bi) ≠ N(B)  N(A)  N(Bi) ≠ N(A)  N(B) And N(Ai) ≠ N(A)  N(Ai)B) ≠ N(A)B) N(Ai) ≠ N(A)  N(Ai)  N(B) ≠ N(A)  N(B) (1) N(A) (1) N(A)  N(B) is not in the list

(2) For all y < N(A) (2) For all y < N(A)  N(B), y is in the list N(A) N(A)  N(B) = y = N(A) = N(B) = The highlighted column is the 1 st where y and N(A) N(A) The highlighted column is the 1 st where y and N(A)  N(B) differ. At that bit position N(A)  N(B) is 1 and y is 0. Therefore one of N(A) and N(B) =1. WLOG assume N(A)=1 Because N(A)=MEX{N(A1),…N(An)} there is a move in A such that the bits after the 1 form any desired pattern. Because N(A)=MEX{N(A1),…N(An)} there is a move in A such that the bits after the 1 form any desired pattern x x x x x x N(Ai) = Therefore we can produce the desired y. QED.

Application to Breaking Chocolates Bored of setting problems for Bytecode, Venkatesh and Akhil decided to take some time off and started to play a game. The game is played on an nxn bar of chocolate consisting of Black and White chocolate cells. Bored of setting problems for Bytecode, Venkatesh and Akhil decided to take some time off and started to play a game. The game is played on an nxn bar of chocolate consisting of Black and White chocolate cells.

Both of them do not like black chocolate, so if the bar consists only of black chocolate cells, it is discarded (Discarding the bar is not considered as a move). If the bar consists only of white chocolate cells, they do not break it further and the bar can be consumed at any time (Eating the bar is considered as a move). If the bar consists of both black and white chocolate cells, it must be broken down into two smaller pieces by breaking the bar along any horizontal or vertical line (Breaking the bar is considered as a move). The player who cannot make a move on any of the remaining bars loses. Both of them do not like black chocolate, so if the bar consists only of black chocolate cells, it is discarded (Discarding the bar is not considered as a move). If the bar consists only of white chocolate cells, they do not break it further and the bar can be consumed at any time (Eating the bar is considered as a move). If the bar consists of both black and white chocolate cells, it must be broken down into two smaller pieces by breaking the bar along any horizontal or vertical line (Breaking the bar is considered as a move). The player who cannot make a move on any of the remaining bars loses. Assuming Venkatesh starts the game and both players are infinitely intelligent, determine who wins the game. Assuming Venkatesh starts the game and both players are infinitely intelligent, determine who wins the game.

Example --- See document camera.

If the dimension of the original chocolate bar is nxn, give an algorithm to compute the who can win, and analyze its running time as a function of n. If the dimension of the original chocolate bar is nxn, give an algorithm to compute the who can win, and analyze its running time as a function of n.

Sprouts

See “Computer Analysis of Sprouts” by Applegate, Jacobson, and Sleator htm

Application to Boxing Match The beauty of Nimbers is that they completely capture what you need to know about a game in order to add it to another game. This can speed up game search exponentially. How would you use this to win in Boxing Match against an opponent who did not know about Nimbers? (My friends Guy Jacobson and David Applegate used this to cream all the other players in the Boxing Match contest.)

Study Bee Sums of games Definition of Nimbers The MEX operator Sum of Games The Nimber Theorem Applications of the theorem: Boxing Match Breaking Chocolates Sprouts