The computer picks a secret number. Type a guess and it tells you whether the number is higher or lower. How few guesses do you need?
Then swap roles: think of a number and the computer finds it by always guessing the middle of what's left. It never needs more than 7 guesses for 1 to 100, and the game shows why.
How to use it
- Choose “I guess” or “The computer guesses”, and a range: 1–10, 1–100 or 1–1000.
- In “I guess”, type a number and press Guess. The arrow tells you to go higher or lower.
- In “The computer guesses”, think of a number, press “I'm ready” and answer each guess with Higher, Lower or Correct.
- Try to match the computer: the best strategy always guesses the middle of the remaining range.
Common uses
- A simple number game for young children practising “bigger” and “smaller”.
- Teaching halving and the idea behind binary search in a maths or computing lesson.
- A quick game for two at home: one thinks of a number, the other guesses.
- Practising estimation and logical thinking.
Examples
| Range | Guesses that always suffice |
|---|---|
| 1–10 | 4 |
| 1–100 | 7Each guess halves the range: 100 → 50 → 25 → 12 → 6 → 3 → 1. |
| 1–1000 | 10 |
Frequently asked questions
What is the best strategy?
Always guess the middle of the numbers that are still possible. Each answer then rules out half of them, so for 1 to 100 you need at most 7 guesses.
How does the computer guess my number?
It keeps track of the lowest and highest numbers still possible and always guesses the middle one. This method is called binary search and is how computers find items in sorted lists quickly.
What if I give a wrong answer?
If your answers contradict each other, the computer notices that no number fits and says so. Then you can start again.
Why 7 guesses for 100 numbers?
Seven halvings can tell apart up to 2⁷ − 1 = 127 numbers, which covers 100. For 1 to 1000 you need 10, because 2¹⁰ − 1 = 1023.
More games
Mental Math Game
MathRandom Number Generator
Generate random numbers in any range: one or many at once, with or without repeats, sorted or not. Uses your browser's cryptographic random source.
Tic-Tac-Toe
LogicNumber Base Converter
Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36. Very large integers are converted exactly.