Each player can remove 1 or 2 pegs. Player who removes the last peg wins

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

Racquetball is a competitive game in which a racquet is used to serve and return a ball.
ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10.
Interval Heaps Complete binary tree. Each node (except possibly last one) has 2 elements. Last node has 1 or 2 elements. Let a and b be the elements in.
AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5  Matchstick Games -
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
Top-Down Design CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
(JUST LIKE PHASE 10 CARD GAME) pHase-ion. General Rules Each player is dealt 10 cards. The remaining cards are placed in the middle for a card pool from.
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
The Game of Nim on Graphs: NimG By Gwendolyn Stockman With: Alan Frieze, and Juan Vera.
Pippin’s Garden Problem There are many solutions depending how efficient you want to be. Generate all possible locations (x,y) for the lower left corner,
Congruence Classes Z n = {[0] n, [1] n, [2] n, …, [n - 1] n } = the set of congruence classes modulo n.
View from 30,000 feet and Introduction to Graph Problems Lecture 19 CS 312.
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:
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas in Computer Science.
MIU Mini-Max Graham Kendall Game Playing Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
Power of a Product and Power of a Quotient Let a and b represent real numbers and m represent a positive integer. Power of a Product Property Power of.
Lesson 10.6a AIM: Variations on Linear Nim. DO NOW.
CS12230 Introduction to Programming Extra example– More on responsibilities 1.
More Induction Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois 1 A Pork-Butchers Shop Seen from a Window Van Gogh.
Benjamin Casey C S 329 E Spring  Variants played since ancient times; resemblance to Chinese “Jianshizi” or “picking stones”  Current name and.
03/05/13 More Induction Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1 Artist: Frank.
A nontransitive talk James Grime. Hi Jim, I was wondering if you can design a set of five non- transitive dice.
Aumm-e-hani munir Maria umer Rakhshanda batool Faiza.
Chapter 3: Proportion and the Golden Ratio
Tower of Hanoi problem: Move the pile of rings from one peg to another
Name 8/29/17.
Subtracting Integers Ch. 11-2D.
Some more Decrease-and-conquer Algorithms
Understanding Subtraction of Integers and Other Rational Numbers
Introductory Game Theory
MA/CSSE 473 Day 19 Sleepsort Finish Nim Josephus problem
Great Theoretical Ideas in Computer Science
9.3 Nim Game (Game with matches)
6.NS.5 Integer War You will need: deck of cards
Goal: use counters to add integers
Game Playing.
New results in Circular Nim
HI !.
Intro to Recursion.
Using Rules to Subtract Integers
1-7 Adding and Subtracting Integers
What two numbers will give you a product of 64 and a quotient of 4?
Isolation – Champion Program
Each player can remove 1 or 2 pegs. Player who removes the last peg wins
Mike Paterson Yuval Peres, Mikkel Thorup, Peter Winkler
Multiplying and Dividing Integers
321 Section, Week 9 Natalie Linnell.
Representations of Integers
Team Dont Block Me, National Taiwan University
In 1922, Neils Bohr won the Nobel prize in physics for his understanding of atomic structure. His theory states that electrons have fixed amounts of energy.
Each player can remove 1 or 2 pegs. Player who removes the last peg wins
Prof. Johnnie Baker Module Induction
Try starting with fewer objects to investigate.
Sequences Tuesday, 30 April 2019.
The Strategic Game of Links
What two numbers will give you a product of 64 and a quotient of 4?
SWBAT Find the Factors of numbers form 2 to 30
Dividing Integers.
Game Theory Day 2: More Simple Games.
Multiplying integers 3(3) = (3) = (3) = (3) = 0 -3
Multiplying and Dividing Integers
Activity 2 How is the word length of a two’s complement representation changed without affecting its value? In this activity, we are going to study how.
Chapter 1 (Part c) Digital Systems and Binary Numbers
Multiplication and Division of Integers
2019 SAIMC Puzzle Challenge General Regulations
Divide two Integers.
Today Binary addition Representing negative numbers 2.
Presentation transcript:

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

420 411 321 410 401 320 311 221 400 310 301 220 211 121 4 2 1 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

Determining P and N positions

421 Winning move! 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

421 Winning move! 420 411 321 410 401 320 311 221 4 2 1 400 310 301 220 211 121 Each player can remove 1 or 2 pegs. Player who removes the last peg wins. 300 210 201 120 111 021 200 110 101 020 011 100 010 001 000

17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 P- and N- positions in substraction game with set {2, 5, 8}. From state K there is a transition to the states K2, K5 and K8 (if those are non-negative).

Generate P and N positions in the substraction game with substraction set {2, 5, 8}. 1 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1 8 5 2 8 2 5 8 2 5 8 2 5 8 2 5

Generate P and N positions in the substraction game with substraction set {2, 5, 8}. 1 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1 8 2 5 8 2 5 8 2 5 8 2 5 8 2 5 8 2 5 etc...

Binary representation of positive integers in Fibonacci base ... 34 21 13 8 5 3 2 1 ... 55 34 21 13 8 5 3 2 1 N = N = 1 1 1 25 1 1 1 1 2 1 1 26 1 1 1 3 1 1 27 1 1 1 1 4 1 1 28 1 1 1 5 1 29 1 1 6 1 1 30 1 1 1 7 1 1 31 1 1 1 8 1 32 1 1 1 9 1 1 33 1 1 1 1 10 1 1 34 1 11 1 1 35 1 1 12 1 1 1 36 1 1 13 1 37 1 1 14 1 1 38 1 1 1 15 1 1 39 1 1 16 1 1 40 1 1 1 17 1 1 1 41 1 1 18 1 1 42 1 1 19 1 1 1 43 1 1 1 20 1 1 1 44 1 1 1 21 1 45 1 1 1 22 1 1 46 1 1 1 1 23 1 1 47 1 1 24 1 1 48 1 1 1

Fibonacci Nim: One pile of tokens. First player can remove 1 or more tokens but not all of them. Next, each player than can remove at most twice the number of tokens removed in his oponent's last move. Player who removes last token wins. base: ... 55 34 21 13 8 5 3 2 1 N = 25 1 1 1 1 26 1 1 1 27 1 1 1 1 28 1 1 1 29 1 1 30 1 1 1 31 1 1 1 32 1 1 1 Let: N be the current number of tokens. RemLim be maximum tokens which can be currently removed. Fmin be the rightmost base element present in N (rightmost 1). 33 1 1 1 1 34 1 35 1 1 36 1 1 37 1 1 38 1 1 1 39 1 1 40 1 1 1 Then: RemLim < Fmin ....... P-position RemLim >= Fmin ........N-position 41 1 1 42 1 1 43 1 1 1 44 1 1 1 45 1 1 1 Rule: In N-position remove Fmin tokens. 46 1 1 1 1 47 1 1 48 1 1 1

RemLim < Fmin ....... P-position RemLim >= Fmin ........N-position base: ... 55 34 21 13 8 5 3 2 1 N = 25 1 1 1 1 Example: Pile with 45 tokens. 26 1 1 1 27 1 1 1 1 28 1 1 1 First move: N = 45, RemLim = 44, Fmin = 3. RemLim >= Fmin .... N-position Remove Fmin: N = 45 3 = 42 29 1 1 30 1 1 1 31 1 1 1 32 1 1 1 33 1 1 1 1 34 1 35 1 1 Next move: The opponent can remove 1 to 6 tokens, that is, he can set the pile to 41, 40, 39, 38, 35, 35 tokens. All these are N-positions, because RemLim = 6, Fmin <= 5. 36 1 1 37 1 1 38 1 1 1 39 1 1 40 1 1 1 41 1 1 42 1 1 43 1 1 1 44 1 1 1 45 1 1 1 46 1 1 1 1 47 1 1 48 1 1 1

RemLim < Fmin ....... P-position RemLim >= Fmin ........N-position base: ... 55 34 21 13 8 5 3 2 1 N = 25 1 1 1 1 Example continues: Opponent took 4. Pile with 38 tokens. 26 1 1 1 27 1 1 1 1 28 1 1 1 29 1 1 30 1 1 1 Next move: N = 38, RemLim = 8, Fmin = 1. RemLim >= Fmin .... N-position Remove Fmin: N = 38 1 = 37 31 1 1 1 32 1 1 1 33 1 1 1 1 34 1 35 1 1 36 1 1 Next move: The opponent can remove 1 or 2 tokens, that is, he can set the pile to 36 or 35 tokens. All these are N-positions, because RemLim = 2, Fmin <= 3. 37 1 1 38 1 1 1 39 1 1 40 1 1 1 41 1 1 42 1 1 43 1 1 1 44 1 1 1 45 1 1 1 46 1 1 1 1 47 1 1 48 1 1 1