The twists of the Ballmer puzzle

The Ballmer puzzle, described in this video is seemingly simple: player A thinks of a number between 1 and 100 (inclusive) and the other player needs to guess it. After each guess, player A tells if it's high or low. Each round the reward goes down by one: 5 if the first guess is correct, 4 if the second, 3, 2, 1, 0, -1, -2, and so on.

Should player B play this game?

The trivial answer is: of course, just use binary search and if player A chooses randomly then the expected value is positive.

The first twist is that player A knows this strategy as well and there are number that are easily guessed (50, for example) and some are not (49 takes many attempts) so will favor numbers that are harder find. When player A uses an adversarial strategy to the binary search then the expected value is negative.

So, the next question: is there an algorithm that is known to player A and still yields a positive return to player B? It turns out there is: https://github.com/gukoff/ballmer_puzzle#winning-strategy

But then I read this comment that puts things into a different perspective:

When Ballmer said 'adversarial', I considered this strategy: he's not actually required to pick a fixed number at the start at all. He can simply give the answer to each guess which leaves the largest number of possible numbers remaining, guaranteeing a loss regardless of strategy.

Played this way, player B will lose every time.

September 20, 2024

Free PDF guide

Sign up to our newsletter and download the "Foreign key constraints in DynamoDB" guide.