💡 Loading fun fact…
BYTE — your
game companion!
🤖 Meet the Challenge!

BYTE the robot is thinking of a secret number between 1 and some maximum. Your job? Guess it!

After each guess, BYTE will tell you: 📈 Too Low!, 📉 Too High!, or 🎉 You got it!

The challenge: can you find the number using as few guesses as possible? Play the game first — then try to discover the best strategy yourself!

🎮 Play Now Interactive Game
Guess BYTE's Secret Number!
BYTE is thinking of a number between
1 and 50
Guesses used:
🎉 You got it!
Guesses: 0
Range: 50
Best possible: 6
🔐 Teacher Reveal Secret Algorithm
⭐ The Unbeatable Strategy!

There is a genius method that can find ANY number in just a handful of guesses — every single time! Computers use this trick millions of times a day. 🖥️
Enter the 6-digit code from your teacher to unlock the secret!

🔒
Ask your teacher for the 6-digit secret code
— type it below to unlock the strategy!

💡 The Big Idea: Always Guess the MIDDLE!

Here is the magic rule: always guess the number in the exact middle of your remaining range. Every single guess cuts your remaining possibilities in half! This is called Binary Search — one of the most important ideas in computer science!

🎯 Watch Binary Search in Action — Step by Step!
lo=1
hi=100
Press "Next Step" to begin!
2 Why Does This Always Work?

Think about it: if you have 100 numbers, after 1 guess you have at most 50 left. After 2 guesses? At most 25. After 3? At most 12 or 13. After 7 guesses, you've narrowed it down to just 1 number!

You're chopping the search space in HALF with each guess. This is like folding a piece of paper — fold it 7 times and it's tiny!

🌳 Binary Search as a Decision Tree (Range: 1–8)
Guess 4 📉 Too High 📈 Too Low Guess 2 Guess 6 📉 High 📈 Low 📉 High 📈 Low 1 3 5 7 ✓1 ✓2 ✓3 ✓4 ✓5 ✓6 ✓7 ✓8 Every number from 1–8 is found in at most 3 guesses! Each level = one guess.
3 The Magic Formula 🔢
✏️ Maximum guesses needed for a range of size N:
Max guesses = ⌈log₂(N)⌉
This means: how many times can you halve N before you reach 1?
• For N = 10: ⌈log₂(10)⌉ = 4 guesses max
• For N = 100: ⌈log₂(100)⌉ = 7 guesses max
• For N = 1000: ⌈log₂(1000)⌉ = 10 guesses max
• For N = 1,000,000: ⌈log₂(1,000,000)⌉ = only 20 guesses! 🤯
🎯 Now play the game using Binary Search!

Start a new game above and use the strategy: always guess the middle of your remaining range! Can you find the number in the minimum number of guesses?

⚡ Watch the Computer Beat the Game Automatically!
Press "Auto Solve" to watch Binary Search find any number!
🎉 This algorithm is called Binary Search — it powers Google, databases, gaming, and almost every computer on earth! You've just learned one of the most important ideas in Computer Science!