Guess the Number: The Hot-and-Cold Game
Somebody picks a secret number. You guess. They tell you whether you are close or far away, and you guess again. Most people play this by wandering up and down until they stumble on it. There is a much better way, and it is short enough to learn in the next five minutes.
Play a round first
In the round below, the page picks the secret number and answers you. Every guess gets two clues back: whether the secret is higher or lower than your guess, and whether you are getting hotter or colder than last time.
Nine numbers are wrong and one is right. See how few tries you need.
What the two clues are worth
They are not worth the same amount, and noticing that is the whole game.
- Hotter and colder compare your new guess with your last guess. They tell you which direction you are moving, but not where the secret is.
- Higher and lower compare your guess with the secret. Every one of them throws away a whole block of numbers at once.
Say you guess 6 and the page says lower. You have not just learned that 6 is wrong. You have learned that 7, 8, 9 and 10 are wrong too. Five numbers gone from one guess.
The trick: cut what is left in half
If a clue can throw away a block of numbers, the best guess is the one that throws away the biggest block whatever the answer turns out to be. That is the number in the middle.
Guess the middle, and either answer cuts your list roughly in half. Do it again and you halve the half. Follow this walkthrough on a range of 1 to 100 and watch how fast the shaded part disappears.
The shaded bar is the part of the number line the secret could still be hiding in. The mark above it is the guess about to be made.
- Start with 1 to 100. Guess the middle: 50. The answer comes back higher.
- Now only 51 to 100 is left, 50 numbers. Guess the middle of that: 75. The answer is lower.
- 51 to 74 is left, 24 numbers. Guess 62. Higher.
- 63 to 74 is left, 12 numbers. Guess 68. Lower.
- 63 to 67 is left. Four guesses have taken a hundred numbers down to five.
Check yourself
You guessed 50 and the page said "higher". Which next guess is the strongest?
- 51, then creep upwards one at a time
- 75, the middle of what is left
- 100, the very top of the range
Creeping up from 51 could take you fifty more guesses. Jumping to 100 only ever rules out one number unless you happen to be right. The middle is the only guess that is guaranteed to be useful whichever answer comes back.
Now try it on a hundred
Same game, a hundred times the hiding places. Halve it each time and you should be done in seven or fewer.
The halving idea is not just for games. It is how you find a word in a dictionary without reading every page, and it is close to how a computer searches a sorted list of a million things in about twenty steps. You have just learned a real one.
Play it where you can see the numbers going
A number is hiding inside a block of numbers. Instead of typing a guess, you slide a cut along the block and press it, and everything on the wrong side of the cut is thrown away in front of you. A cut at the end of the block throws away one number. A cut down the middle throws away half of them, whichever answer comes back. Sixteen numbers in six guesses, then fifty in seven, then a hundred in seven — which is exactly enough, and only if every cut halves what is left.