{
  "index": "2020-B-2",
  "type": "COMB",
  "tag": [
    "COMB",
    "NT"
  ],
  "difficulty": "",
  "question": "Let $k$ and $n$ be integers with $1 \\leq k < n$. Alice and Bob play a game with $k$ pegs in a line of $n$ holes. At the beginning of the game, the pegs occupy the $k$ leftmost holes. A legal move consists of moving a single peg\nto any vacant hole that is further to the right. The players alternate moves, with Alice playing first. The game ends when the pegs are in the $k$ rightmost holes, so whoever is next to play cannot move and therefore loses. For what values\nof $n$ and $k$ does Alice have a winning strategy?",
  "solution": "We refer to this two-player game, with $n$ holes and $k$ pegs, as the \\emph{$(n,k)$-game}.\nWe will show that Alice has a winning strategy for the $(n,k)$-game if and only if at least one of $n$ and $k$ is odd; otherwise Bob has a winning strategy.\n\nWe reduce the first claim to the second as follows. If $n$ and $k$ are both odd, then Alice can move the $k$-th peg to the last hole; this renders the last hole, and the peg in it, totally out of play, thus reducing the $(n,k)$-game to the $(n-1,k-1)$-game, for which Alice now has a winning strategy by the second claim. Similarly, if $n$ is odd but $k$ is even, then Alice may move the first peg to the $(k+1)$-st hole, removing the first hole from play and reducing the $(n,k)$-game to the $(n-1,k)$ game. Finally, if $n$ is even but $k$ is odd, then Alice can move the first peg to the last hole, taking the first and last holes, and the peg in the last hole, out of play, and reducing the $(n,k)$-game to the $(n-2,k-1)$-game.\n\nWe now assume $n$ and $k$ are both even and describe a winning strategy for the $(n,k)$-game for Bob.\nSubdivide the $n$ holes into $n/2$ disjoint pairs of adjacent holes. Call a configuration of $k$ pegs \\textit{good} if for each pair of holes, both or neither is occupied by pegs, and note that the starting position is good. Bob can ensure that after each of his moves, he leaves Alice with a good configuration: presented with a good configuration, Alice must move a peg from a pair of occupied holes to a hole in an unoccupied pair; then Bob can move the other peg from the first pair to the remaining hole in the second pair, resulting in another good configuration. In particular, this ensures that Bob always has a move to make. Since the game must terminate, this is a winning strategy for Bob.",
  "vars": [],
  "params": [
    "k",
    "n"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "k": "pegcount",
        "n": "holecount"
      },
      "question": "Let $pegcount$ and $holecount$ be integers with $1 \\leq pegcount < holecount$. Alice and Bob play a game with $pegcount$ pegs in a line of $holecount$ holes. At the beginning of the game, the pegs occupy the $pegcount$ leftmost holes. A legal move consists of moving a single peg\nto any vacant hole that is further to the right. The players alternate moves, with Alice playing first. The game ends when the pegs are in the $pegcount$ rightmost holes, so whoever is next to play cannot move and therefore loses. For what values\nof $holecount$ and $pegcount$ does Alice have a winning strategy?",
      "solution": "We refer to this two-player game, with $holecount$ holes and $pegcount$ pegs, as the \\emph{$(holecount,pegcount)$-game}.\nWe will show that Alice has a winning strategy for the $(holecount,pegcount)$-game if and only if at least one of $holecount$ and $pegcount$ is odd; otherwise Bob has a winning strategy.\n\nWe reduce the first claim to the second as follows. If $holecount$ and $pegcount$ are both odd, then Alice can move the $pegcount$-th peg to the last hole; this renders the last hole, and the peg in it, totally out of play, thus reducing the $(holecount,pegcount)$-game to the $(holecount-1,pegcount-1)$-game, for which Alice now has a winning strategy by the second claim. Similarly, if $holecount$ is odd but $pegcount$ is even, then Alice may move the first peg to the $(pegcount+1)$-st hole, removing the first hole from play and reducing the $(holecount,pegcount)$-game to the $(holecount-1,pegcount)$ game. Finally, if $holecount$ is even but $pegcount$ is odd, then Alice can move the first peg to the last hole, taking the first and last holes, and the peg in the last hole, out of play, and reducing the $(holecount-2,pegcount-1)$-game.\n\nWe now assume $holecount$ and $pegcount$ are both even and describe a winning strategy for the $(holecount,pegcount)$-game for Bob.\nSubdivide the $holecount$ holes into $holecount/2$ disjoint pairs of adjacent holes. Call a configuration of $pegcount$ pegs \\textit{good} if for each pair of holes, both or neither is occupied by pegs, and note that the starting position is good. Bob can ensure that after each of his moves, he leaves Alice with a good configuration: presented with a good configuration, Alice must move a peg from a pair of occupied holes to a hole in an unoccupied pair; then Bob can move the other peg from the first pair to the remaining hole in the second pair, resulting in another good configuration. In particular, this ensures that Bob always has a move to make. Since the game must terminate, this is a winning strategy for Bob."
    },
    "descriptive_long_confusing": {
      "map": {
        "k": "bluewhale",
        "n": "raspberry"
      },
      "question": "Let $bluewhale$ and $raspberry$ be integers with $1 \\leq bluewhale < raspberry$. Alice and Bob play a game with $bluewhale$ pegs in a line of $raspberry$ holes. At the beginning of the game, the pegs occupy the $bluewhale$ leftmost holes. A legal move consists of moving a single peg to any vacant hole that is further to the right. The players alternate moves, with Alice playing first. The game ends when the pegs are in the $bluewhale$ rightmost holes, so whoever is next to play cannot move and therefore loses. For what values of $raspberry$ and $bluewhale$ does Alice have a winning strategy?",
      "solution": "We refer to this two-player game, with $raspberry$ holes and $bluewhale$ pegs, as the \\emph{$(raspberry,bluewhale)$-game}.\nWe will show that Alice has a winning strategy for the $(raspberry,bluewhale)$-game if and only if at least one of $raspberry$ and $bluewhale$ is odd; otherwise Bob has a winning strategy.\n\nWe reduce the first claim to the second as follows. If $raspberry$ and $bluewhale$ are both odd, then Alice can move the $bluewhale$-th peg to the last hole; this renders the last hole, and the peg in it, totally out of play, thus reducing the $(raspberry,bluewhale)$-game to the $(raspberry-1,bluewhale-1)$-game, for which Alice now has a winning strategy by the second claim. Similarly, if $raspberry$ is odd but $bluewhale$ is even, then Alice may move the first peg to the $(bluewhale+1)$-st hole, removing the first hole from play and reducing the $(raspberry,bluewhale)$-game to the $(raspberry-1,bluewhale)$ game. Finally, if $raspberry$ is even but $bluewhale$ is odd, then Alice can move the first peg to the last hole, taking the first and last holes, and the peg in the last hole, out of play, and reducing the $(raspberry-2,bluewhale-1)$-game.\n\nWe now assume $raspberry$ and $bluewhale$ are both even and describe a winning strategy for the $(raspberry,bluewhale)$-game for Bob.\nSubdivide the $raspberry$ holes into $raspberry/2$ disjoint pairs of adjacent holes. Call a configuration of $bluewhale$ pegs \\textit{good} if for each pair of holes, both or neither is occupied by pegs, and note that the starting position is good. Bob can ensure that after each of his moves, he leaves Alice with a good configuration: presented with a good configuration, Alice must move a peg from a pair of occupied holes to a hole in an unoccupied pair; then Bob can move the other peg from the first pair to the remaining hole in the second pair, resulting in another good configuration. In particular, this ensures that Bob always has a move to make. Since the game must terminate, this is a winning strategy for Bob."
    },
    "descriptive_long_misleading": {
      "map": {
        "k": "vacancies",
        "n": "solidness"
      },
      "question": "Let $vacancies$ and $solidness$ be integers with $1 \\leq vacancies < solidness$. Alice and Bob play a game with $vacancies$ pegs in a line of $solidness$ holes. At the beginning of the game, the pegs occupy the $vacancies$ leftmost holes. A legal move consists of moving a single peg\nto any vacant hole that is further to the right. The players alternate moves, with Alice playing first. The game ends when the pegs are in the $vacancies$ rightmost holes, so whoever is next to play cannot move and therefore loses. For what values\nof $solidness$ and $vacancies$ does Alice have a winning strategy?",
      "solution": "We refer to this two-player game, with $solidness$ holes and $vacancies$ pegs, as the \\emph{$(solidness,vacancies)$-game}.\nWe will show that Alice has a winning strategy for the $(solidness,vacancies)$-game if and only if at least one of $solidness$ and $vacancies$ is odd; otherwise Bob has a winning strategy.\n\nWe reduce the first claim to the second as follows. If $solidness$ and $vacancies$ are both odd, then Alice can move the $vacancies$-th peg to the last hole; this renders the last hole, and the peg in it, totally out of play, thus reducing the $(solidness,vacancies)$-game to the $(solidness-1,vacancies-1)$-game, for which Alice now has a winning strategy by the second claim. Similarly, if $solidness$ is odd but $vacancies$ is even, then Alice may move the first peg to the $(vacancies+1)$-st hole, removing the first hole from play and reducing the $(solidness,vacancies)$-game to the $(solidness-1,vacancies)$ game. Finally, if $solidness$ is even but $vacancies$ is odd, then Alice can move the first peg to the last hole, taking the first and last holes, and the peg in the last hole, out of play, and reducing the $(solidness,vacancies)$-game to the $(solidness-2,vacancies-1)$-game.\n\nWe now assume $solidness$ and $vacancies$ are both even and describe a winning strategy for the $(solidness,vacancies)$-game for Bob.\nSubdivide the $solidness$ holes into $solidness/2$ disjoint pairs of adjacent holes. Call a configuration of $vacancies$ pegs \\textit{good} if for each pair of holes, both or neither is occupied by pegs, and note that the starting position is good. Bob can ensure that after each of his moves, he leaves Alice with a good configuration: presented with a good configuration, Alice must move a peg from a pair of occupied holes to a hole in an unoccupied pair; then Bob can move the other peg from the first pair to the remaining hole in the second pair, resulting in another good configuration. In particular, this ensures that Bob always has a move to make. Since the game must terminate, this is a winning strategy for Bob."
    },
    "garbled_string": {
      "map": {
        "k": "qzxwvtnp",
        "n": "hjgrksla"
      },
      "question": "Let $qzxwvtnp$ and $hjgrksla$ be integers with $1 \\leq qzxwvtnp < hjgrksla$. Alice and Bob play a game with $qzxwvtnp$ pegs in a line of $hjgrksla$ holes. At the beginning of the game, the pegs occupy the $qzxwvtnp$ leftmost holes. A legal move consists of moving a single peg to any vacant hole that is further to the right. The players alternate moves, with Alice playing first. The game ends when the pegs are in the $qzxwvtnp$ rightmost holes, so whoever is next to play cannot move and therefore loses. For what values of $hjgrksla$ and $qzxwvtnp$ does Alice have a winning strategy?",
      "solution": "We refer to this two-player game, with $hjgrksla$ holes and $qzxwvtnp$ pegs, as the \\emph{$(hjgrksla,qzxwvtnp)$-game}.\nWe will show that Alice has a winning strategy for the $(hjgrksla,qzxwvtnp)$-game if and only if at least one of $hjgrksla$ and $qzxwvtnp$ is odd; otherwise Bob has a winning strategy.\n\nWe reduce the first claim to the second as follows. If $hjgrksla$ and $qzxwvtnp$ are both odd, then Alice can move the $qzxwvtnp$-th peg to the last hole; this renders the last hole, and the peg in it, totally out of play, thus reducing the $(hjgrksla,qzxwvtnp)$-game to the $(hjgrksla-1,qzxwvtnp-1)$-game, for which Alice now has a winning strategy by the second claim. Similarly, if $hjgrksla$ is odd but $qzxwvtnp$ is even, then Alice may move the first peg to the $(qzxwvtnp+1)$-st hole, removing the first hole from play and reducing the $(hjgrksla,qzxwvtnp)$-game to the $(hjgrksla-1,qzxwvtnp)$ game. Finally, if $hjgrksla$ is even but $qzxwvtnp$ is odd, then Alice can move the first peg to the last hole, taking the first and last holes, and the peg in the last hole, out of play, and reducing the $(hjgrksla,qzxwvtnp)$-game to the $(hjgrksla-2,qzxwvtnp-1)$-game.\n\nWe now assume $hjgrksla$ and $qzxwvtnp$ are both even and describe a winning strategy for the $(hjgrksla,qzxwvtnp)$-game for Bob.\nSubdivide the $hjgrksla$ holes into $hjgrksla/2$ disjoint pairs of adjacent holes. Call a configuration of $qzxwvtnp$ pegs \\textit{good} if for each pair of holes, both or neither is occupied by pegs, and note that the starting position is good. Bob can ensure that after each of his moves, he leaves Alice with a good configuration: presented with a good configuration, Alice must move a peg from a pair of occupied holes to a hole in an unoccupied pair; then Bob can move the other peg from the first pair to the remaining hole in the second pair, resulting in another good configuration. In particular, this ensures that Bob always has a move to make. Since the game must terminate, this is a winning strategy for Bob."
    },
    "kernel_variant": {
      "question": "Let $n$ and $k$ be integers with $1\\le k<n$.  Carmen and Diego play the following game on a row of $n$ boxes numbered $1,2,\\dots ,n$ from left to right.  At the outset $k$ identical stones occupy the $k$ \\\\emph{right–most} boxes $n-k+1,n-k+2,\\dots ,n$.  A legal move consists of selecting one stone and sliding it into any still–empty box strictly \\emph{to the left} of its current position.  The players move alternately, with Carmen moving first.  The game terminates when the $k$ stones have reached the $k$ left–most boxes $1,2,\\dots ,k$; whoever would have to play next then has no legal move and therefore loses.\n\nFor which pairs $(n,k)$ does Carmen have a winning strategy?",
      "solution": "We restate the game in the “stones move left” form, which is equivalent to the original “pegs move right” game by reflecting hole i to box n+1−i.  We then prove:\n\nTheorem.  In the (n,k)–game (stones start in boxes n−k+1,…,n, each move slides one stone strictly left into an empty box, the player unable to move when stones reach 1,…,k loses), the first player (Carmen) wins if and only if at least one of n and k is odd.\n\nProof.  We split into two cases.\n\nCase I: At least one of n,k is odd.  We describe Carmen’s first move, which “freezes” one or two boxes and reduces the game to one with both parameters even, with Diego to play.\n\n1.  n and k both odd.  Carmen slides the stone from box n−k+1 all the way to box 1.  Box 1 is then unusable, and the remaining stones lie in boxes 2…n (with k−1 stones in n−k+2…n).  Renumber these boxes 1…n−1; we obtain an (n−1,k−1)–game with n−1,k−1 even, and it is Diego’s turn.\n\n2.  n odd, k even.  Carmen slides the stone from box n to box n−k.  Box n is frozen.  The remaining k stones occupy n−k…n−1 in boxes 1…n−1, so we have an (n−1,k)–game with n−1,k even, Diego to move.\n\n3.  n even, k odd.  Carmen slides the stone from box n all the way to box 1.  Boxes 1 and n are frozen.  The remaining k−1 stones lie in boxes n−k+1…n−1 within the segment 2…n−1.  Renumber 2…n−1 as 1…n−2; we get an (n−2,k−1)–game with n−2,k−1 even, Diego to move.\n\nIn each subcase, both parameters in the reduced game are even, and it is Diego’s turn.  We will show:\n\nClaim.  In any (n,k)–game with n and k even, the player whose turn it is (the “first mover” in that position) loses under perfect play.\n\nProof of Claim (the pairing/mirroring strategy).\n\n•  Partition the boxes 1,2,…,n into adjacent pairs {1,2},{3,4},…,{n−1,n}.  Call a configuration \"good\" or \"balanced\" if each pair contains either 0 or 2 stones.  The starting position (k even, stones in the k rightmost boxes) is balanced.\n\n•  We show that if it is Carmen’s turn and the current position is balanced, then after her move the position becomes unbalanced, but Diego can always restore the balance on his move.  In particular, Diego never runs out of moves, so the game must terminate on Carmen’s turn, making her the loser in the even–even game.\n\n  1.  Before Carmen moves, the position is balanced.  She must take a stone from some full pair P (which has 2 stones) and slide it strictly left into an empty pair Q (which has 0 stones).  After her move, P has exactly 1 stone and exactly 1 empty box; Q has exactly 1 stone and 1 empty box; all other pairs remain with 0 or 2 stones.  Thus exactly two pairs are now “defective,” each containing exactly one stone, and all others are again 0 or 2.\n\n  2.  Diego’s reply: In the source pair P, one stone remains.  He slides that remaining stone into the one empty box of Q.  Now P has 0 stones, Q has 2 stones, and every other pair was unchanged.  Hence every pair again contains 0 or 2 stones, i.e. the position is balanced.  Diego thus always has a legal move and never allows the game to end on his turn.\n\n  3.  Since each move of a stone decreases the multiset of its box–indices in lexicographic order, the game is finite.  Diego’s strategy ensures the game cannot end on his turn, so it must end on Carmen’s turn.  Therefore, in any even–even position with Diego first, the second player (Diego) wins, meaning the first mover (Carmen) loses.\n\nThis proves the Claim.  Returning to Case I, Carmen’s initial parity–reduction move hands Diego an even–even position in which Diego (as first mover) loses.  Hence Carmen wins whenever at least one of n,k is odd.\n\nCase II: n and k both even.  Then the original position is already an even–even game, with Carmen to play first.  By the Claim, the first mover in an even–even game loses.  Thus Carmen loses and Diego has a winning strategy.\n\nConclusion.  Carmen has a winning strategy if and only if at least one of n and k is odd.  ■",
      "_meta": {
        "core_steps": [
          "Parity reduction: if n or k is odd, Alice makes a first move that deletes 1 (or 2) boundary holes/pegs so Bob is left to play an (n',k')-game with both numbers even.",
          "Pairing strategy: when n and k are even, Bob partitions the line into n/2 adjacent 2-hole blocks.",
          "Invariant: call a position good if every block contains 0 or 2 pegs; the starting position is good.",
          "Mirror move: whenever Alice moves a peg from a full block to an empty block, Bob moves the partner peg so the position is good again.",
          "Because Bob can always reply while keeping the invariant, the play must end with Alice to move; hence Bob wins in the even–even case, and Alice wins otherwise."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "Names of the two players.",
            "original": "Alice, Bob"
          },
          "slot2": {
            "description": "Geometric orientation – pegs start in the k leftmost holes and may only move toward the right (could be rightmost/leftward after a global reflection).",
            "original": "left-to-right line; legal moves are toward larger indices"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof"
}