Number Guessing Game
Guess the secret number between 1 and 100. Get higher/lower hints. Fewest guesses wins.
How to play
- The computer picks a secret number from 1 to 100.
- Type your guess and click Guess (or press Enter).
- You'll get a "Too high" or "Too low" hint after each guess.
- Narrow the range with each guess — binary search (start at 50) finds it in ≤7 tries.
- Correct! shows your guess count; try to beat your best.
The computer picks a secret number between 1 and 100. Type your guess and receive higher/lower hints. Try to find it in as few guesses as possible — the mathematical minimum is 7 with a perfect binary search strategy.
Frequently asked questions
- What is the best strategy?
- Binary search: always guess the midpoint of the remaining range. Starting at 50, then adjusting by half each time, you can always find the number in at most 7 guesses.
- Is the number truly random?
- Yes — Math.random() generates a new number each game with equal probability for 1–100.