Iurii RoguliaIurii Rogulia
AboutServicesPricingProjectsStackReviewsPhrasesBlog
Contact
Iurii ships.

Iurii Rogulia, senior full-stack software engineer. Professionally building software since 2001.

Think of a number
PricingQuality checklistPrivacy PolicyCookie Policy

Business

TMI Iurii Rogulia
VAT ID: FI29845875
DUNS: 368664211
Lappeenranta, Finland 🇫🇮

[email protected]
  1. Home
  2. /
  3. Blog
  4. /
  5. Binary Search Explained: How It Works (Visualized)

Iurii Visualizes: Binary Search Explained: How It Works (Visualized)

Pick any number between 1 and 1000 — the computer finds it every time. Try the game, then read why it works.

March 6, 2026· 3 min read

An interactive binary search game: pick any number between 1 and 1000 and the algorithm finds it in 10 steps or fewer. Play first, then read the explanation.

Topics

FunAlgorithmsInteractive
Binary Search Explained: How It Works (Visualized)

Think of a number. Any number between 1 and 1000.

Don't write it down. Don't tell anyone. Just hold it in your head.

?

Think of a number

1—1000

I'll guess it in 10 steps or fewer.
Any number. No tricks.


If you just came back — you saw it happen. You answered a few questions, and the computer landed on your number. Not by luck. Every time. For any number you could have picked.

There's something quietly unsettling about that. You were certain you had control. You chose the number. You gave the hints. And yet it felt like the game was over before it started.

The Trick Isn't What You Think

It's not a trick, actually. No hidden camera. No reading your mouse movements. No AI trying to predict human behaviour.

What the computer is doing is something much older and stranger: it eliminates half the remaining possibilities with every single guess.

You start with 1,024 possible numbers. After one question, 512 are gone. After two, 512 become 256. Then 128. Then 64. Then 32. Then 16. Then 8. Then 4. Then 2. Then 1.

Ten steps. Any number. Every time.

It works because the space of possibilities — no matter how large — collapses exponentially when you cut it in half repeatedly. 2 to the power of 10 is 1,024. That's more than 1,000, which is why 10 questions are always enough.

You may have noticed the game says 1 to 1,000, not 1 to 1,024. That's intentional. Showing 1,024 would hand you the answer before you'd even started — a power of two is a dead giveaway to anyone who's ever written code. So the upper bound is 1,000, and numbers from 1,001 to 1,024 simply don't exist as far as the game is concerned. If the algorithm's arithmetic ever lands above 1,000, it silently answers "lower" to itself and moves on. You never see it. The math still works.

This is called binary search. It's one of the oldest ideas in computer science, and it shows up everywhere — in databases, in dictionary lookups, in version control, in how your phone's contacts list finds a name in milliseconds.

But the reason I like it as a party trick is that it reveals something about intuition versus math. When you're choosing a number, 1000 feels like a lot. A machine guessing it in 10 steps feels like magic. The reality is neither: it's just that the space of possibilities collapses faster than human intuition expects.

Why I Built This

I build software for a living — mostly EU e-commerce and SaaS systems where the hard problems are in the complexity: tax rules for 32 countries, order automation pipelines, AI integrations that have to be fast and cheap at scale. The pikkuna.fi platform handles 30 languages and 32 countries; the vatnode VAT validation SaaS serves all EU member states. Both rely on the same principle: simple, well-understood algorithms applied at the right layer.

But the ideas underneath all of that are usually simple. Binary search is one of them. I built this game because it's the cleanest demonstration I know of how a small, elegant rule can feel impossible from the outside and obvious once you see it.

If you haven't played yet, go try it. Pick a difficult number. See how many guesses it takes.

It'll be fewer than you expect.

If you're curious about the engineering behind the systems I've built — read UUID v7 in Production: Why Your Database Hates v4 for another case where the simple algorithm underneath turns out to be the important one. Or get in touch if you have a real project to discuss.

Iurii RoguliaAvailable

Ready to work together?

Senior full-stack software engineer based in Finland. Tell me what you're building — I respond within 24 hours.

More articles

Related articles

Deterministic Wrong: Why a Viral Web Toy Must Be Wrong the Same Way Every Time
June 29, 2026· 7 min
Deterministic Wrong: Why a Viral Web Toy Must Be Wrong the Same Way Every Time

Deterministic random in JavaScript: why a viral web toy dies if it uses Math.random(), and how FNV-1a + mulberry32 make the same wrong answer reproducible

Stack

JavaScript

Topics

Viral ProductAlgorithmsWeb Development
Building a React Product Configurator with Zustand and Motion
April 21, 2026· 12 min
Building a React Product Configurator with Zustand and Motion

How to build a React product configurator with Zustand state, DaisyUI components, Motion animations, and live SVG preview — architecture, pricing logic, and

Stack

Next.jsReactTypeScript

Libraries

DaisyUIFramer MotionZustandnanoid

Topics

Product ConfiguratorUI/UXE-commerceInteractive
I Ran My Business With AI for 30 Days: Results and Lessons
April 1, 2026· 10 min
I Ran My Business With AI for 30 Days: Results and Lessons

What happens when you let AI run your business for 30 days: emails, code, decisions. Week 1 was suspiciously good. Week 4 involved a 3am payment deploy.

Topics

Fun