GuessTheNumber

How to Play GuessTheNumber

The rules, the exact scoring formula, and the strategy that minimizes your expected number of attempts.

The basic rules

  1. Every day, one secret number between 1 and 100 is generated and stays fixed until the daily reset.
  2. Choose a short username (no account needed) to appear on the leaderboard.
  3. You get up to 10 guesses per day. Each guess is scored immediately.
  4. Your single best-scoring guess from the day is the one that counts toward the leaderboard.

How scoring actually works

Most number-guessing games treat every wrong guess identically — you either found it or you didn't. GuessTheNumber instead scores every single guess using two inputs: how far off it was, and which attempt number it was.

score = clamp( 100 − distance − (attempt − 1) × 6, 0, 100 )

distance is the absolute difference between your guess and the secret number. attempt is which guess number this is in your session (1 for your first guess that day). Two consequences fall directly out of this formula:

  • A first-attempt exact match always scores exactly 100 — the maximum possible.
  • A close-but-wrong guess can outscore a far-but-wrong guess even on the same attempt number. If the secret number is 45, guessing 46 scores 99, while guessing 99 scores 46 — both wrong, but proximity still counts.

The optimal strategy: binary search

If your only goal is to find the exact number in the fewest attempts, the provably optimal approach is a binary search: always guess the midpoint of the range that is still mathematically possible, given what your previous guesses have told you (via the hot/cold distance feedback shown after each guess).

This works because each guess splits the remaining possibility space roughly in half. Since 100 numbers require at most ⌈log₂(100)⌉ = 7 halvings to narrow down to a single value, binary search guarantees finding any number between 1 and 100 within 7 attempts — well inside the 10-attempt limit.

AttemptGuessRemaining rangeReasoning
1501–100Split the full range in half.
27551–100Told "higher" — split the remaining 50 numbers.
36351–75Told "lower" — split the remaining 25 numbers.
46764–75Told "higher" — split the remaining 12 numbers.
567exactMatch found within 5 attempts, guaranteed.

Worked example: secret number is 67. Perfect binary search finds it in 5 attempts — well under both the 7-attempt worst case and the 10-attempt daily limit.

Why pure binary search isn't always the highest-scoring play

Binary search minimizes the number of attempts to certainty — but GuessTheNumber rewards proximity on every attempt, including ones before you win. Two players who both eventually solve it in 5 attempts can post different scores depending on how close their earlier, wrong guesses were. Because the attempt penalty (6 points per attempt) is fixed regardless of strategy, the only lever you actually control each guess is distance — so once you have narrowed the range using the hot/cold feedback, biasing your next guess toward your strongest hunch inside that range, rather than the mathematical midpoint, can occasionally edge out a marginally better score without materially increasing your risk of missing the exact number.

Common mistakes

  • Guessing randomly instead of narrowing the range. Ignoring the hot/cold feedback from previous guesses wastes attempts that binary search would have used to halve the range.
  • Re-guessing a number you've already ruled out. If a previous guess told you the number is higher than 50, guessing anything 50 or below again cannot be correct and only burns an attempt.
  • Waiting too long to lock in a username. Usernames expire after 24 hours — claim yours before you start playing so your first guess isn't wasted on a failed session.

Frequently asked questions

What is the best strategy for GuessTheNumber?

Binary search — always guess the midpoint of the range that is still possible, rather than guessing randomly. This guarantees finding any number between 1 and 100 within 7 attempts (mathematically, ⌈log₂(100)⌉ = 7), and often fewer if you get lucky splits.

Is it better to guess randomly close to a previous guess, or use binary search?

Binary search dominates in expected attempts needed, but GuessTheNumber scores every guess by proximity, not just win/loss — so a "risky" first guess near a number you have a hunch about isn't irrational if it is closer than the binary-search midpoint would be. The scoring model rewards being close even when you are technically wrong.

Why does a wrong guess still earn points?

Because distance from the secret number is part of the score, not just a binary correct/incorrect flag. This means two players who both guess wrong are not tied at zero — the closer guess scores higher, which keeps near-misses meaningful instead of wasted.

Does guessing correctly on a later attempt ever beat a first-attempt win?

No. A first-attempt exact match always scores the maximum of 100, because there is no attempt-based penalty applied yet. Any correct guess after attempt 1 scores below 100, since each additional attempt subtracts a fixed penalty from the maximum.

Is the number the same for every player each day?

Yes. One secret number is generated per calendar day (UTC) and every player that day is guessing against it, which is what makes the daily leaderboard a fair, apples-to-apples comparison.