Number Guessing Game

Can you find the secret number? The game tells you if your guess is too high or too low.

Runs in browser Runs in browser

Strategy Tip

Use binary search: always guess the midpoint of the current range. For 1–100, this finds the number in at most 7 guesses. For 1–1000, at most 10 guesses.

Maksimum Deneme

ZorlukMaks.
1–100 (Kolay)7
1–500 (Orta)9
1–1000 (Zor)10

İkili arama stratejisiyle

How to use?

  1. 1
    Choose DifficultySelect Easy (1–100), Medium (1–500), or Hard (1–1000), then click New Game.
  2. 2
    Enter Your GuessType a number and click Guess. The game tells you if the secret is higher or lower.
  3. 3
    Find the NumberKeep narrowing it down. The range bar shows your remaining possibilities.

FAQ

What is the minimum number of guesses needed?
With optimal binary search strategy: 7 guesses for 1–100, 9 guesses for 1–500, and 10 guesses for 1–1000. Random guessing takes longer on average.
Is the number truly random?
Yes. The secret number is generated using Math.random() in your browser each time you start a new game. It is not predetermined.
Does the game save my score?
Scores are not saved between sessions. This is a casual, in-browser game with no account or data storage.

How to Play the Number Guessing Game

The computer picks a secret number within the chosen range. You enter guesses one at a time, and the game responds with Too High or Too Low after each attempt. Your goal is to find the exact number in as few guesses as possible.

Binary Search Strategy

The most efficient strategy is binary search: always guess the midpoint of the current possible range. If the range is 1–100, guess 50. If told too high, the range becomes 1–49 — guess 25. This approach guarantees finding any number in 1–100 within 7 guesses, any number in 1–1000 within 10 guesses.

Why Is This Game Educational?

The guessing game is a classic introduction to binary search — one of the most fundamental algorithms in computer science. It demonstrates how logarithmic efficiency works in practice: doubling the range only adds one extra guess needed.

Comments