Monday, September 7, 2015

Periodicity (focus on subtraction games)

What is periodicity?
The tendency of a function to repeat itself in a regular pattern at established intervals. To be periodic there must be a consistent repetition of values over the entire domain of the function

Periodicity of Subtraction Games 
I will focus on periodicity of nim-sequences of subtraction games, denoted SUBTRACTION(S).  In order to be a subtraction game the following conditions must be satisfied:
  two-player game involving a pile of chips.
• a finite set S of positive integers called the subtraction set. Subtraction sets S = s1, s2, ..., sk will be ordered s1 < s2 < < sk.
• The two players move alternately, subtracting some s chips such that s  S.
• The game ends when a position is reached from which no moves are possible for the player whose turn it is to move. The last player to move wins

finite subtraction game denoted SUBTRACTION(­­­­a1, a2, . . . , ak), if S = {a1, a2, . . . , ak} is finite

all-but subtraction game denoted ALLBUT({a1, a2, . . . , ak}, if S = {1,2,3,…} | {a1, a2, . . . , ak} consists of all the positive integers except a finite set

subtraction game is periodic as we will prove later and ALLBUT() is another name for NIM and is arithmetic periodic with saltus 1

Types of periodicity:
1)   periodic – if there is some l >= 0 and p > 0 so that G(n +p) = G(n) for all n>=1
2)   arithmetic periodic – if there is l >=0 , p > 0, and s > 0 so that G(n +p) =
G(n) + s for all n >= l
3)   sapp regular (split arithmetic periodic/periodic)- if there exist integers
            l >= 0, s >0, p > 0, and a set S  {0, 1, 2, . . . , p − 1} such that for all n ≥ l,
            G(n + p)  = ( G(n) if (n mod p)  S,
                                    G(n) + s if (n mod p) not in S.
 purely periodic, purely arithmetic periodic, or purely Sapp regular just infers that there is no pre-period along with previous stated conditions

Subsequence G(0), G(1),..G((l-1) is called pre-period and its elements are the exceptional values l  is pre-period length, p is period length, and s is saltus

Practice:
Match each sequence on the left one-to-one to a category on the right:
1231451671 . . . periodic
1123123123 . . . purely periodic
1122334455 . . . sapp regular
0123252729 . . . arithmetic periodic
0120120120 . . . purely sapp regular
1112233445 . . . purely arithmetic periodic
In each case, identify the period and pre-period

Finding the pre-period and period of subtraction games:
Ex.1: S = {2,4,7}
The Grundy Sequence starts G = 01122003102102102102, this means G(1)=0, G(2) = 1, G(3)=1, and G(4)=2 etc.
From the pattern forming we can see G = 0112203$\overline{102}$so the pre-period is 0112203 and it has a period of 3, 102

Ex.2: S = {1,9,10} G =$\overline{101010101232323232}$,} this example has no pre-period and a period of 19, it can also be written as G = $\overline{(10)^41(23)^420}$

Theorem:  The nim-sequences of finite subtraction games are periodic.
Proof: Consider the finite subtraction game subtraction(a1, a2, . . . , ak) and its nim-sequence. From any position there are at most k legal moves. So, using Observation 7.22, G(n) ≤ k for all n. Define a = max{ai}. Since G(n) ≤ k for all n there are only finitely many possible blocks of a consecutive values that can arise in the nim-sequence. So we can find positive integers q and r with a ≤ q < r such that the a values in the nim-sequence immediately preceding q are the same as those immediately preceding r. Then G(q) = G(r) since G(q) = mex{G(q − ai) | 1 ≤ i ≤ k} = mex{G(r − ai) | 1 ≤ i ≤ k} = G(r). In fact, for such q and r and all t ≥ 0, G(q + t) = G(r + t). This is easily shown by induction — we have just seen the base case, and the inductive step is really just an instance of the base case translated t steps forwards. Now set l = q and p = r − q and we see that the above says that for all n ≥ l, G(n + p) = G(n); that is, that the nim-sequence is periodic.

Corollary: Let G = subtraction(a1, a2, . . . , ak) and let a = max{ai}. If l and p are positive integers such that G(n) = G(n + p) for l ≤ n < l + a, then the nim-sequence for G is periodic with period length p and pre-period length l.

Why it’s important :
Periodicity is important because by representing a game as a periodic nim sequence we can compute the value of any single heap efficiently. The value of any sums of heaps and therefore a perfect winning strategy can be computed using nim-addition rule. Once the game is known to be periodic it is solved



Sources:



























8 comments:

  1. Lauren, nice work simplifying periodicity; you had a lot of in-depth (and often esoteric) source material to pull from. I read some of the sources that you had to work with--namely Ferguson and Lessons in Play--and I'm not sure I understand the way that they presented the different types of periodicity. Also, what is a "saltus"? I look forward to hearing all about it tomorrow.

    ReplyDelete
  2. I liked how you gave us a practice problem part way through. Wow, it seems like you can invent infinitely many take and break games. With take and break games are the rules always predetermined? If the moves depend on the history of the game can you still use periodicity analysis? I too am confused as to what is a saltus.

    ReplyDelete
    Replies
    1. Great question, Seneth... In a pure combinatorial game, the rules don't depend on anything but the position (so they don't depend on history of moves). But definitely we could consider a generalization where we waive this restriction. That would be super interesting! Periodicity analysis might still apply...

      Delete
  3. Hey Lauren, I really enjoyed your post and presentation. Periodicity makes a lot more sense to me now that you have explained it in person. I was wondering if periodicity was used to solve games other than subtraction games. I guess as long as you can determine the nim sequence of a game, you can also determine if it is periodic. In that case, you could determine the periodicity of a graph game similar to the one we used in class the other day. I also was curious as to how periodicity worked differently in misere games- I think that what be something interesting to look further into.
    Thanks again!

    ReplyDelete
    Replies
    1. Periodicity seems like a tough concept to flesh out, but this post, as well as the in-class presentation, helped me understand the basics of its role in our subtraction games. I too am curious as to how periodicity relates to other kinds of games. Could finding the Grundy Sequence for certain games be very difficult? Or do the sequence for some games make it very hard to find a periodic element just by looking at it?
      While I don't mean to imply I am a blog post aficionado, I will say that one thing this post could use to be better is a reordering. It might make more sense to explain the numbers of periodicity before showing how they apply to subtraction games, and it would be useful to define l, p, and s to us before using them in defining the types of periodicity. Still, a 2nd read though was enough to make sense of it and your blackboard explanation of the subject was more than enough to wrap it all together.

      Delete
    2. This is a great point by both of you... Periodicity definitely applies to games beyond subtraction games! Any game where you can computer the Sprague Grundy values of positions might have some sort of periodicity. For more on this, check out the section in Lessons on Play on periodicity.

      Delete
  4. I wasnt quite sure on the details of this topic but you did a great job of explaining and making everything so much more clear. Its really cool to think about the different patterns and sequences that arise from a set of numbers and how they can relate to these games. Is there a specific game that comes from periodic numbers? Im curious to see how a common game would go with these thoughts as the roots!

    ReplyDelete
    Replies
    1. Hey Jon, if I understand the question correctly, it sounds like you're asking if we can pick a particular periodic sequence of integers and find a combinatorial game whose nim-sequence is given by this particular sequence? In general the answer would likely be no, since Sprague Grundy values are determined by the mex. But it may be the case that if we restrict our attention to certain sequences (for instance, if we always make sure that our repeating pattern includes a 0?), then we can find an algorithm for finding a game with the right nim-sequence. I like it!

      Delete