7 attempts left
Guess the number between 1 and 100 in 7 tries.
About Number Guess
Number Guess hides a secret number between 1 and 100 and tells you only whether each guess was too high or too low. It looks trivial, and it is genuinely fun for young children, but it is also a perfect hands-on demonstration of one of the most important ideas in computer science: binary search.
If you guess randomly, you might need dozens of attempts. If you always guess the midpoint of the range that is still possible, you halve the remaining possibilities every single time — which means any number from 1 to 100 can be found in at most seven guesses, guaranteed. Start at 50; if the answer is higher, the range becomes 51 to 100, so guess 75, and so on. That halving strategy is exactly how a computer searches a sorted list of a million items in twenty steps, and playing a few rounds makes the idea click in a way that a description rarely does.
How to Play Number Guess
- Enter any number between 1 and 100 and submit your guess.
- Read the feedback — the game tells you whether the secret number is higher or lower.
- Use that answer to rule out half the remaining range, then guess again.
- Keep narrowing until you land on it. Try to beat your best score in fewest guesses.
Tips & Strategy
- Always guess the middle of what is still possible. Starting at 50 guarantees you can find any number within seven guesses.
- Track the range out loud or on paper at first — "it is between 26 and 37 now" — so you do not accidentally re-guess a number you have already eliminated.
- Resist hunches. A lucky guess feels good but the midpoint strategy beats intuition over any run of games.
Frequently Asked Questions
Seven. Halving a range of 100 takes at most seven steps, so the midpoint strategy can never need more than that no matter which number is hidden.
Yes, a new secret number is chosen at the start of each round, so previous answers tell you nothing about the next game.
It is the clearest possible illustration of binary search. Halving the search space each step is why a computer can find one record among a million in about twenty comparisons.
Very. It needs only number comparison, and it quietly teaches an efficient strategy — children usually discover the halving trick themselves after a few rounds.