15-251 Great Theoretical Ideas in Computer Science.

Slides:



Advertisements
Similar presentations
Semantic of (Ongoing work with S. Hayashi, T. Coquand) Jouy-en-Josas, France, December 2004 Stefano Berardi, Semantic of Computation group C.S. Dept.,
Advertisements

THE WELL ORDERING PROPERTY Definition: Let B be a set of integers. An integer m is called a least element of B if m is an element of B, and for every x.
ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10.
Introduction to Combinatorial Game Acm Honored Class Weitao.
Sam Chow. One Player Games Bored MUMSians Han writes the numbers 1, 2,..., 100 on the MUMS whiteboard. He picks two of these numbers, erases them, and.
Nim, nim.py and games.py Homework 4 Problem 4. The History of Nim Games Believed to have been created in China; unknown date of origin First actual recorded.
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.
New Toads and Frogs Results By Jeff Erickson Presented by Nate Swanson.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4) David Martin This work is licensed under.
The Game of Nim on Graphs: NimG Gwendolyn Stockman Alan Frieze and Juan Vera.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
CSE115/ENGR160 Discrete Mathematics 02/07/12
The Game of Nim on Graphs: NimG By Gwendolyn Stockman With: Alan Frieze, and Juan Vera.
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:
Graphs, relations and matrices
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.
Nimbers! By: Alyssa Godesky. Nimbers come from a game called Nim, one of the oldest known strategy games.
Applied Discrete Mathematics Week 9: Relations
Kim Moore, Program Manager Dr. Tonya Jeffery, Co-PI.
Game Playing.
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
A few leftover Decrease-and-conquer Algorithms
Part II - Sums of Games Consider a game called Boxing Match which was defined in a programming contest m.short.html.
Impartial Games, Nim, Composite Games, Optimal Play in Impartial games
Section 1.8. Section Summary Proof by Cases Existence Proofs Constructive Nonconstructive Disproof by Counterexample Nonexistence Proofs Uniqueness Proofs.
Surreal Number Tianruo Chen. Introduction In mathematics system, the surreal number system is an arithmetic continuum containing the real number as infinite.
MA/CSSE 473 Day 23 Transform and Conquer. MA/CSSE 473 Day 23 Scores on HW 7 were very high (class average was 93%). Good job! (Score was not included.
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.
Extending the Definition of Exponents © Math As A Second Language All Rights Reserved next #10 Taking the Fear out of Math 2 -8.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Game theory Impartial Games.  Two-person games with perfect information  No chance moves  A win-or-lose outcome  Impartial games ◦ Set of moves available.
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.
1 Binomial Coefficients CS 202 Epp, section ??? Aaron Bloomfield.
CPSC 171 Introduction to Computer Science More Algorithm Discovery and Design.
Crystal Bennett Joshua Chukwuka Advisor: Dr. K. Berg.
Lesson 10.6a AIM: Variations on Linear Nim. DO NOW.
An Introduction to Game Theory Math 480: Mathematics Seminar Dr. Sylvester.
Winning Strategies of Games Played with Chips. I got a interesting game Now we show the game P 1 =4 P 2 =6 P 3 =8 Rule 1: Two players.
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
1. 2 You should know by now… u The security level of a strategy for a player is the minimum payoff regardless of what strategy his opponent uses. u A.
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.
Advanced Engineering Mathematics, 7 th Edition Peter V. O’Neil © 2012 Cengage Learning Engineering. All Rights Reserved. CHAPTER 4 Series Solutions.
Theory of Computation Lecture 5: Primitive Recursive Functions I
CompSci Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the.
Transfinite Chomp Scott Huddleston and Jerry Shurman Presented by Ehren Winterhof.
CPS Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the “right-hand”
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.
Benjamin Casey C S 329 E Spring  Variants played since ancient times; resemblance to Chinese “Jianshizi” or “picking stones”  Current name and.
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.
Content Game of Nim Impartial Games Sprague-Grundy theorem
Some more Decrease-and-conquer Algorithms
Introductory Game Theory
Silvia Heubach Department of Mathematics NSS Retreat, May 25, 2017
MA/CSSE 473 Day 19 Sleepsort Finish Nim Josephus problem
Great Theoretical Ideas in Computer Science
Great Theoretical Ideas in Computer Science
Great Theoretical Ideas In Computer Science
Perturbation method, lexicographic method
SCIT1003 Chapter 2: Sequential games - perfect information extensive form Prof. Tsang.
Chapter 5 Induction and Recursion
NIM - a two person game n objects are in one pile
Mathematical Games Sam Chow.
Duo By: Fernando & Vivian.
Game Theory Day 2: More Simple Games.
CSE 321 Discrete Structures
Presentation transcript:

Great Theoretical Ideas in Computer Science

Combinatorial Games Lecture 2 (August 30, 2007)

21 chips Two Players: I and II A move consists of removing one, two, or three chips from the pile Players alternate moves, with Player I starting The player that removes the last chip wins A Take-Away Game Which player would you rather be?

Try Small Examples! If there were 1, 2, or 3 only, player who moves next wins If there are 4 chips left, player who moves next must leave 1, 2 or 3 chips left, and his opponent will be able to win If there are 5, 6 or 7 chips left, the player who moves next can win by moving to the position with four chips left

0, 4, 8, 12, 16, … are target positions; if a player moves to that position, they can win the game Therefore, with 21 chips, Player I can win! 21 chips

Combinatorial Games There are two players There is a finite set of possible positions The rules of the game specify for both players and each position which moves to other positions are legal moves. The players alternate moving The game ends in a finite number of moves (no draws!)

Normal Versus Misère Normal Play Rule: The last player to move wins Misère Play Rule: The last player to move loses A Terminal Position is one where neither player can move anymore

What is Omitted No random moves No hidden moves No draws in a finite number of moves (This rules out games like poker) (This rules out games like battleship) (This rules out tic-tac-toe)

P-Positions and N-Positions P-Position: Positions that are winning for the Previous player (the player who just moved) N-Position: Positions that are winning for the Next player (the player who is about to move)

0, 4, 8, 12, 16, … are P-positions; if a player moves to that position, they can win the game 21 chips is an N-position 21 chips

What’s a P-Position? “Positions that are winning for the Previous player (the player who just moved)” That means: For any move that N makes There exists a move for P such that For any move that N makes There exists a move for P such that … There are no possible moves for N

P-positions and N-positions can be defined recursively by the following: (1) All terminal positions are P-positions (2) From every N-position, there is at least one move to a P-position (3) From every P-position, every move is to an N-position

Chomp! Two-player game, where each move consists of taking a square and removing it and all squares to the right and above. Player who takes position (1,1) loses

Show That This is a P-position N-Positions!

Show That This is an N-position P-position!

Let’s Play! I’m player I

No matter what you do, I can mirror it!

Mirroring is an extremely important strategy in combinatorial games!

Theorem: Player I can win in any square starting position of Chomp Proof: The winning strategy for player I is to chomp on (2,2), leaving only an “L” shaped position Then, for any move that Player II takes, Player I can simply mirror it on the flip side of the “L”

Theorem: Player I can win in any rectangular starting position Proof: Look at this first move: If this is a P-position, then player 1 wins Otherwise, there exists a P-position that can be obtained from this position And player 1 could have just taken that move originally

The Game of Nim xyz Two players take turns moving Each move consists of selecting one of the piles and removing chips from it (you can take as many as you want, but you have to at least take one) In one move, you cannot remove chips from more than one pile Winner is the last player to remove chips

xyz We use (x,y,z) to denote this position (0,0,0) is a:P-position Analyzing Simple Positions

One-Pile Nim What happens in positions of the form (x,0,0)? The first player can just take the entire pile, so (x,0,0) is an N-position

Two-Pile Nim P-positions are those for which the two piles have an equal number of chips If it is the opponent’s turn to move from such a position, he must change to a position in which the two piles have different number of chips From a position with an unequal number of chips, you can easily go to one with an equal number of chips (perhaps the terminal position)

Nim-Sum The nim-sum of two non-negative integers is their addition without carry in base 2 We will use  to denote the nim-sum 2  3 = 5  3 = 7  4 = (10) 2  (11) 2 = (01) 2 = 1 (101) 2  (011) 2 = (110) 2 = 6 (111) 2  (100) 2 = (011) 2 = 3  is associative:(a  b)  c = a  (b  c)  is commutative:a  b = b  a

For any non-negative integer x, x  x = 0

Cancellation Property Holds If x  y = x  z Then x  x  y = x  x  z So y = z

Bouton’s Theorem: A position (x,y,z) in Nim is a P-position if and only if x  y  z = 0 Let Z denote the set of Nim positions with nim-sum zero Proof: Let NZ denote the set of Nim positions with non-zero nim-sum We prove the theorem by proving that Z and NZ satisfy the three conditions of P- positions and N-positions

(1) All terminal positions are in Z (2) From each position in NZ, there is a move to a position in Z The only terminal position is (0,0,0)   Look at leftmost column with an odd # of 1s Rig any of the numbers with a 1 in that column so that everything adds up to zero

(3) Every move from a position in Z is to a position in NZ If (x,y,z) is in Z, and x is changed to x < x, then we cannot have x  y  z = 0 = x  y  z Because then x = x

Here’s What You Need to Know… Combinatorial Games P-positions versus N-positions When there are no draws, every position is either P or N Nim Definitions of the game Nim-sum Bouton’s Theorem