Library · The Fiddler: Solutions · Chapter 66

Can You Hack Bowling?

Revised Report an error

In ten-pin bowling, a strike (all ten on the first ball) scores 1010 plus your next two balls; a spare (all ten in two balls) scores 1010 plus your next ball; an open frame scores the pins it knocks down. What is the minimum total number of pins you must knock down to reach a score of at least 100100?

The Fiddler, Zach Wissner-Gross, July 11, 2025(original post)

Solution

Strikes are the efficient move: each knocks ten pins but, through bonuses, can be worth up to thirty. Four strikes followed by a single frame of 22 and 22 already reaches exactly 100100: 30+30+22+14⏟four strikes+4⏟the 2,2=100,\underbrace{30+30+22+14}_{\text{four strikes}}+\underbrace{4}_{\text{the }2,2}=100, knocking down 10+10+10+10+2+2=4410+10+10+10+2+2=\boxed{44} pins. Since a strike yields the most score per pin, no game does better.

The computation

Search the efficient family of games, some leading strikes plus one ordinary frame, scoring each with the bowling rules and keeping the fewest pins that still reach 100100. The minimum is 4444, from four strikes and a 2,22,2.

def score(r):
    s = i = 0
    for _ in range(10):
        if i >= len(r): break
        if r[i] == 10: s += 10 + r[i+1] + r[i+2]; i += 1
        else:
            s += (10 + r[i+2]) if r[i] + r[i+1] == 10 else r[i] + r[i+1]; i += 2
    return s
best, arg = 10**9, None
for k in range(0, 11):                        # k leading strikes
    for a in range(11):
        for b in range(11 - a):               # one ordinary frame (a, b)
            if score([10]*k + [a, b] + [0]*30) >= 100 and 10*k + a + b < best:
                best, arg = 10*k + a + b, (k, a, b)
print(best, arg)                              # 44 (4, 2, 2)

Extra Credit

You and your opponent each play a game in which you knock down the same total number of pins, yet your scores differ as much as they possibly can. What is the greatest possible difference between the two scores?

Solution

The idea is to split every score into the pins themselves and the bonus on top. Each ball’s pins count once in the frame where they fall. A strike or spare in frames 11 to 99 then counts the next one or two balls a second time, and that repeat is the bonus. The tenth frame is different: its extra balls exist only to complete that frame, so they count once and earn no bonus of their own. Hence score  =  pins+bonus,\text{score} \;=\; \text{pins} + \text{bonus}, where the bonus comes from frames 11 to 99 alone.

An upper bound. A frame’s bonus is at most 2020: a strike repeats the next two balls, worth at most 1010 each, and a spare repeats one ball. With nine frames able to earn a bonus, the bonus is at most 9×20=1809 \times 20 = 180. So for any pin total PP, the higher score is at most P+180P + 180 and the lower is at least PP. The difference can never exceed 180180.

The bound is reached. Both bowlers knock down 111111 pins.

  • You bowl nine strikes, then strike, strike and 11 in the tenth frame: 90+21=11190 + 21 = 111 pins. Frames 11 to 99 each score 3030 (each strike is followed by two more balls of 1010), and the tenth scores 2121, so the total is 270+21=291270 + 21 = 291.

  • Your opponent bowls 99 then 00 in each of frames 11 to 99 (8181 pins, no bonus), then three strikes in the tenth (3030 pins, counted once). That is 111111 pins and a score of exactly 111111.

The difference is 291−111=180291 - 111 = 180, the largest the bound allows: 180.\boxed{180}. The tenth frame is what makes this work. Because its strikes earn nothing extra, the opponent can absorb 3030 pins there without a single bonus point, which lifts the bonus-free pin total from 9090 to 111111. That leaves room for the other bowler to collect all nine maximal bonuses. Any total from 110110 to 119119 pins works equally well.

The computation

The check does not use the pins-plus-bonus split. It scores games ball by ball from the rules, bowling all ten frames over every legal combination of balls, and for each pin total it records the lowest and highest score possible. A full listing of games is far too large, but the only thing a frame passes on to later frames is how many extra times the next two balls will count. So the search carries, for each such pair of weights, a table of pin totals with their lowest and highest scores, and it extends that table one frame at a time.

def frame_options(last):
    """Every legal way to bowl one frame, as a list of balls."""
    if not last:
        yield [10]                                    # strike
        for a in range(10):
            for b in range(11 - a):
                yield [a, b]                          # spare or open frame
    else:                                             # the tenth frame
        for a in range(10):
            for b in range(10 - a):
                yield [a, b]                          # open: two balls
            for c in range(11):
                yield [a, 10 - a, c]                  # spare: one bonus ball
        for b in range(11):
            for c in range(11 if b == 10 else 11 - b):
                yield [10, b, c]                      # strike: two bonus balls

# state: extra weight carried by the next ball and the ball after it
# value:  {pins: (lowest score, highest score)}
states = {(0, 0): {0: (0, 0)}}
for frame in range(10):
    last = frame == 9
    new = {}
    for (w1, w2), table in states.items():
        for balls in frame_options(last):
            weights = [1 + w1, 1 + w2, 1][:len(balls)]
            pts = sum(w*x for w, x in zip(weights, balls))
            if last: nxt = (0, 0)
            elif balls == [10]: nxt = (w2 + 1, 1)     # strike: next two balls count again
            elif sum(balls) == 10: nxt = (1, 0)       # spare: next ball counts again
            else: nxt = (0, 0)
            pins = sum(balls)
            slot = new.setdefault(nxt, {})
            for p, (lo, hi) in table.items():
                old = slot.get(p + pins, (10**9, -1))
                slot[p + pins] = (min(old[0], lo + pts), max(old[1], hi + pts))
    states = new
games = states[(0, 0)]
gap = max(hi - lo for lo, hi in games.values())
print("largest difference:", gap)
print("pin totals achieving it:", [p for p, (lo, hi) in games.items() if hi - lo == gap])
print("fewest pins for a score of 100:", min(p for p, (lo, hi) in games.items() if hi >= 100))

It prints

largest difference: 180
pin totals achieving it: [110, 111, 112, 113, 114, 115, 116, 117, 118, 119]
fewest pins for a score of 100: 44

The last line rechecks the main puzzle by the same exhaustive search.

Report an error on this page

Reports are stored by Netlify. See the privacy note.