Partizan subtraction outcome sequences

One heap of tokens. Left may remove any number in her set SL, Right any number in his set SR; whoever cannot move loses. Every heap size has an outcome: P (the second player wins), N (the first player wins), L or R (that player wins whoever starts). The sequence of outcomes is eventually periodic (Fraenkel–Kotzig 1987); here the exact preperiod and period are computed for any sets. The map redraws the paper's Figure 1, and the game below plays a sum of heaps with canonical values, every move marked ✓ (keeps the win) or ✗.

outcome sequence

Heaps 0, 1, 2, … left to right. The preperiod is underlined in grey, each copy of the period in gold. Hover a heap for its value.

play a sum of heaps

value of the sum

behaviour map SR = {c, d}, SL fixed

eventually L eventually R mixed period. c → right, d → up, 1…100. Click a square to load SR = {c, d}.

How it is computed

Write oL(n) for "Left wins moving first" and oR(n) for "Right wins moving first". Both depend only on the last max(SL ∪ SR) heaps, so the windows of that length run into a cycle. Brent's cycle finder (with a rolling hash, checked in full on a match) gives the exact minimal period, and walking back gives the minimal preperiod. Values of heaps are built from their options and reduced to canonical form; the value of a sum is the sum of the values.

Checked against the literature

E. Duchêne, M. Heinrich, R. J. Nowakowski and A. Parreau, Partizan Subtraction Games (arXiv 2101.01595). Every theorem, lemma and example that can be decided by enumeration holds on the ranges tested (13 checks, 435,309 cases). The Frobenius proposition holds with the preperiod read as the largest non-L heap (counted as positions it is one more). Figure 1 is reproduced square by square: off the diagonal the left panel agrees everywhere and the right panel differs on four games, {12,17}, {13,18}, {14,18} and {15,19}, which the figure shows as mixed but which become R for good after 84 to 192 heaps. The open question in Section 3 has small answers in the negative direction: for SL = {1,2,4} no SR of four numbers outside SL, up to 40, makes Right dominate, and among SL ⊆ {1..7} there are 33 such sets, all containing 1. The distance condition of the general two-against-two theorem holds with room to spare: no game that fails to be eventually L lies further than 15 from the lines, where the theorem asks for 20 to 104.