Back

Number Guess

0
Attempts
-
Best

Number Guessing Game

I'll think of a number, you try to guess it!

Advertisement

Number Guess hides a number in a stated range and tells you after each attempt whether the target is higher or lower. Your task is to find it in as few guesses as possible.

It is a small game with a genuinely useful idea inside it. The optimal approach is binary search, and it is one of the clearest demonstrations of why halving a problem beats scanning it.

How to play

  1. Enter a guess within the stated range.
  2. Read the hint telling you whether the target is higher or lower.
  3. Use that to narrow your range and guess again.
  4. Find the number in as few attempts as you can.

The efficient method

  • Always guess the midpoint of the range that remains. This halves the possibilities with every attempt regardless of the answer.
  • Update both ends of your range after each hint, not just the one you were told about.
  • Recognise the scale: a range of one to a hundred takes at most seven guesses using this method, and one to a thousand takes at most ten.
  • Resist guessing a number that feels likely. Feelings do not narrow the range; midpoints do.

Frequently asked questions

What is the fastest way to guess the number?
Guess the midpoint of the remaining range each time. This is binary search, and it halves the possibilities with every guess, which is provably optimal.
How many guesses should it take?
At most seven for a range of one to a hundred, and at most ten for one to a thousand, provided you halve the range each time.
Is this useful for learning?
Yes. It is a clear practical demonstration of binary search and of estimating with ranges, which is why it is often used to introduce the idea to students.