{
  "index": "1993-B-2",
  "type": "COMB",
  "tag": [
    "COMB",
    "NT"
  ],
  "difficulty": "",
  "question": "Consider the following game played with a deck of $2n$ cards numbered\nfrom 1 to $2n$. The deck is randomly shuffled and $n$ cards are dealt to\neach of two players. Beginning with $A$, the players take turns\ndiscarding one of their remaining cards and announcing its number. The\ngame ends as soon as the sum of the numbers on the discarded cards is\ndivisible by $2n+1$. The last person to discard wins the game. Assuming\noptimal strategy by both $A$ and $B$, what is the probability that $A$ wins?",
  "solution": "Solution. Player \\( B \\) can always win, because \\( B \\) can always guarantee that \\( A \\) will not win on the next move: \\( B \\) holds one more card than \\( A \\), and each of \\( A \\) 's cards causes at most one of \\( B \\) 's cards to be a fatal play. Hence \\( B \\) has at least one safe play. Player \\( B \\) wins on the last move if not earlier, since the sum of the numbers on all the cards is \\( n(2 n+1) \\).",
  "vars": [],
  "params": [
    "n",
    "A",
    "B"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "n": "halfdeck",
        "A": "playera",
        "B": "playerb"
      },
      "question": "Consider the following game played with a deck of $2halfdeck$ cards numbered\nfrom 1 to $2halfdeck$. The deck is randomly shuffled and $halfdeck$ cards are dealt to\neach of two players. Beginning with $playera$, the players take turns\ndiscarding one of their remaining cards and announcing its number. The\ngame ends as soon as the sum of the numbers on the discarded cards is\ndivisible by $2halfdeck+1$. The last person to discard wins the game. Assuming\noptimal strategy by both $playera$ and $playerb$, what is the probability that $playera$ wins?",
      "solution": "Solution. Player \\( playerb \\) can always win, because \\( playerb \\) can always guarantee that \\( playera \\) will not win on the next move: \\( playerb \\) holds one more card than \\( playera \\), and each of \\( playera \\) 's cards causes at most one of \\( playerb \\) 's cards to be a fatal play. Hence \\( playerb \\) has at least one safe play. Player \\( playerb \\) wins on the last move if not earlier, since the sum of the numbers on all the cards is \\( halfdeck(2 halfdeck+1) \\)."
    },
    "descriptive_long_confusing": {
      "map": {
        "n": "caterpillar",
        "A": "lighthouse",
        "B": "marshmallow"
      },
      "question": "Consider the following game played with a deck of $2caterpillar$ cards numbered\nfrom 1 to $2caterpillar$. The deck is randomly shuffled and $caterpillar$ cards are dealt to\neach of two players. Beginning with $lighthouse$, the players take turns\ndiscarding one of their remaining cards and announcing its number. The\ngame ends as soon as the sum of the numbers on the discarded cards is\ndivisible by $2caterpillar+1$. The last person to discard wins the game. Assuming\noptimal strategy by both $lighthouse$ and $marshmallow$, what is the probability that $lighthouse$ wins?",
      "solution": "Solution. Player \\( marshmallow \\) can always win, because \\( marshmallow \\) can always guarantee that \\( lighthouse \\) will not win on the next move: \\( marshmallow \\) holds one more card than \\( lighthouse \\), and each of \\( lighthouse \\) 's cards causes at most one of \\( marshmallow \\) 's cards to be a fatal play. Hence \\( marshmallow \\) has at least one safe play. Player \\( marshmallow \\) wins on the last move if not earlier, since the sum of the numbers on all the cards is \\( caterpillar(2 caterpillar+1) \\)."
    },
    "descriptive_long_misleading": {
      "map": {
        "n": "limitless",
        "A": "audience",
        "B": "spectator"
      },
      "question": "Consider the following game played with a deck of $2limitless$ cards numbered\nfrom 1 to $2limitless$. The deck is randomly shuffled and $limitless$ cards are dealt to\neach of two players. Beginning with $audience$, the players take turns\ndiscarding one of their remaining cards and announcing its number. The\ngame ends as soon as the sum of the numbers on the discarded cards is\ndivisible by $2limitless+1$. The last person to discard wins the game.\nAssuming optimal strategy by both $audience$ and $spectator$, what is\nthe probability that $audience$ wins?",
      "solution": "Solution. Player \\( spectator \\) can always win, because \\( spectator \\) can always guarantee that \\( audience \\) will not win on the next move: \\( spectator \\) holds one more card than \\( audience \\), and each of \\( audience \\) 's cards causes at most one of \\( spectator \\) 's cards to be a fatal play. Hence \\( spectator \\) has at least one safe play. Player \\( spectator \\) wins on the last move if not earlier, since the sum of the numbers on all the cards is \\( limitless(2 limitless+1) \\)."
    },
    "garbled_string": {
      "map": {
        "n": "qzxwvtnp",
        "A": "hjgrksla",
        "B": "pqowieur"
      },
      "question": "Consider the following game played with a deck of $2qzxwvtnp$ cards numbered\nfrom 1 to $2qzxwvtnp$. The deck is randomly shuffled and $qzxwvtnp$ cards are dealt to\neach of two players. Beginning with $hjgrksla$, the players take turns\ndiscarding one of their remaining cards and announcing its number. The\ngame ends as soon as the sum of the numbers on the discarded cards is\ndivisible by $2qzxwvtnp+1$. The last person to discard wins the game. Assuming\noptimal strategy by both $hjgrksla$ and $pqowieur$, what is the probability that $hjgrksla$ wins?",
      "solution": "Solution. Player \\( pqowieur \\) can always win, because \\( pqowieur \\) can always guarantee that \\( hjgrksla \\) will not win on the next move: \\( pqowieur \\) holds one more card than \\( hjgrksla \\), and each of \\( hjgrksla \\)'s cards causes at most one of \\( pqowieur \\)'s cards to be a fatal play. Hence \\( pqowieur \\) has at least one safe play. Player \\( pqowieur \\) wins on the last move if not earlier, since the sum of the numbers on all the cards is \\( qzxwvtnp(2 qzxwvtnp+1) \\)."
    },
    "kernel_variant": {
      "question": "Let k be a positive integer.  A deck contains 6k distinct cards numbered 1,2,…,6k.  After a random shuffle 3k cards are dealt to Peggy and the remaining 3k cards to Quentin.  Peggy moves first. \n\nOn each turn the player whose turn it is chooses one of her/his remaining cards, discards it face-up and announces its number.  Keep a running total of all announced numbers.  The game stops as soon as this running total is divisible by 6k+1, and the player who made that most recent discard wins the game.\n\nAssuming optimal play by both contestants, what is the probability that Peggy (the first player) wins?",
      "solution": "Write M = 6k + 1 and keep every running total modulo M.\n\n1.  Notation\n   •  After t turns let S_t (mod M) be the current total of the discarded numbers.\n   •  Just before Quentin’s (the second player’s) move the two hands contain\n         r   cards for Peggy and\n         r+1 cards for Quentin,   \n     because Peggy has just played.\n     Denote these hands by A (Peggy) and B (Quentin).\n\n2.  When can Peggy win on her next move?\n   If Quentin now discards a card b∈B, the new total becomes\n         S_{t+1} ≡ S_t + b (mod M).\n   Peggy will win on her immediately following move precisely when she owns a card\n         c such that S_{t+1}+c ≡ 0 (mod M),\n   i.e.\n         c ≡ −S_{t+1} ≡ M − S_t − b   (mod M).            (1)\n   For the fixed current value S_t and each candidate b we therefore define\n         f(b) :=  M − S_t − b   (taken in {1,2,…,6k}).\n   Peggy can win after b is played ⇔ f(b) is in A.\n\n3.  A counting fact guaranteeing Quentin a ‘safe’ card\n   The map  f : B → {1,…,6k}  is injective:  if b_1 ≠ b_2 then\n         f(b_1) = M − S_t − b_1 ≠ M − S_t − b_2 = f(b_2).\n   Hence the r+1 different cards of B are sent to r+1 different values f(b).\n   But Peggy’s hand A contains only r cards, so not all f(b) can lie in A.\n   Therefore\n         There exists at least one card b* ∈ B for which f(b*) ∉ A.       (2)\n\n4.  Quentin’s optimal strategy\n   On every move Quentin does the following.\n   Step Q1   If some card b ∈ B satisfies S_t + b ≡ 0 (mod M) he plays that card and wins immediately.\n   Step Q2   Otherwise he chooses the card b* guaranteed by (2) and discards it.\n             Because f(b*) ∉ A, relation (1) shows that Peggy does **not** own the\n             unique card that would give her victory on her next turn.  Hence she\n             cannot win immediately.\n\n5.  Why Peggy can never win\n   Inductively, Quentin’s strategy ensures after each of his turns that the running\n   total is non-zero and that Peggy lacks a winning reply, so she never makes the\n   total 0.  Consequently the first time the total becomes divisible by M is when\n   Quentin himself plays a card satisfying Step Q1.\n\n   If, improbably, no such card ever occurs earlier, the game eventually reaches\n   the very last card.  Since Peggy moved first, Quentin moves last, and the sum\n   of **all** 6k cards equals\n         1 + 2 + … + 6k = 3k(6k + 1) = 3k·M ≡ 0 (mod M),\n   Quentin’s final card necessarily makes the total 0 and he still wins.\n\n6.  Conclusion\n   Quentin (the second player) has a strategy that guarantees victory for every\n   possible initial deal.  Therefore, under optimal play,\n\n        Probability(Peggy wins) = 0.",
      "_meta": {
        "core_steps": [
          "Card-counting: after every move by the first player, the second player still holds one extra card.",
          "Pigeonhole: any card just played rules out at most one of the second player’s cards, so a ‘safe’ discard always exists for the second player.",
          "Induction/iteration: the second player can therefore survive every round and is certain to make the final discard.",
          "Arithmetic fact: the sum of all 2n card numbers is n(2n+1), which is 0 mod (2n+1).",
          "Consequently the last (second) player wins with certainty ⇒ probability first player wins is 0."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "size parameter for the deck (half the number of cards each player initially holds)",
            "original": "n"
          },
          "slot2": {
            "description": "total number of cards in the deck, must be an even multiple of slot1",
            "original": "2n"
          },
          "slot3": {
            "description": "modulus that defines the winning divisibility condition; chosen so that the full-deck sum is 0 mod this number",
            "original": "2n+1"
          },
          "slot4": {
            "description": "labels/order of the two players (first vs. second); swapping them leaves the reasoning intact with roles reversed",
            "original": "A (first), B (second)"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "calculation",
  "iteratively_fixed": true
}