1The Puzzle
2Front Door
3Gift Hunt
4Search Diary
5Blueprint Room
6Trial Rooms
Chapter 1 Β· The Puzzle

πŸ€” Just Think About It

Imagine you're standing in a huge place, a maze, a city, a cave, or a game world. Somewhere around you is something you're looking for: a treasure, a friend, an exit, or a charging station. You cannot see the entire area, so you have to discover new places as you move.

From where you are, you can only see the places directly connected to your current location. As you explore, each place may lead you to several more places, gradually revealing more of the surroundings.

Let's play a game where you'll explore a set of connected places to find a nearby target. Follow the available paths carefully and decide which places to explore first so that you can find the target as quickly as possible without unnecessarily going farther away.

Let's see exactly what that looks like πŸ‘‡

Chapter 2 Β· Front Door

🎁 Somewhere in this house... a gift.

It's a birthday, and a gift is hidden somewhere inside the house. The child starts at the Front Door, you decide which room gets checked next. Only nearby rooms will glow, click one. Watch closely as you play. There's a pattern here worth noticing.

3rd Floor🧸 Playroom Β· πŸ“¦ Storage Room
2nd FloorπŸ“– Study Β· 🍼 Nursery Β· πŸͺœ Stairway Landing
1st FloorπŸ›οΈ Bedroom Β· πŸ“š Library Β· πŸ’Ό Office
Ground FloorπŸ›‹οΈ Living Room Β· 🍳 Kitchen Β· 🍽️ Dining Room Β· 🧳 Lobby
StartπŸšͺ Front Door
🚧 Rule: only rooms next to an already-checked room will ever glow
Chapter 3 Β· The Gift Hunt

Search the House, Room by Room

NOTE: Play manually by clicking glowing rooms, or press Start Auto-Play to watch it happen, your choice!

πŸšͺ Your Options From Here (rooms you can check right now)

The child is standing at the Front Door. Click a glowing room to check it.

Rooms checked0/12
Floor clearedStart
Rooms glowing4
1x

πŸ’‘ Try to click every glowing room on the current floor before any room upstairs even has a chance to glow, that's the pattern to watch for.

πŸ€” How are you finding the gift room?

πŸŽ‰πŸŽπŸŽ‰

You found the gift in 0 rooms checked!

Here's the order you checked rooms in, notice how it moved floor by floor:

Curious why this pattern always works? Head to the Blueprint Room for the full breakdown, plus a quick animated demo.

Chapter 4 Β· Search Diary

What did you notice?

Sit with these for a moment, there's no single "correct" wording, just think them through in your own words.

Q1 Β· Exploring Nearby FirstWhy did checking all nearby rooms before moving farther away make the search more systematic?
Q2 Β· Keeping the OrderWhen several rooms were waiting to be explored, why was it useful to check them in the order they were discovered?
Q3 Β· Changing the StrategyWhat would become harder or less reliable if you always explored the newest discovered room first instead?
Q4 Β· Finding the Shortest RouteWhy does checking closer rooms first help you find the shortest route?
Q5 Β· Discovering the StrategyBased on what you experienced in the game, what rules would you give another person so they could repeat the same search successfully?
Chapter 5 Β· Blueprint Room

How the search really worked

Tap a card to open it up and see the idea behind what you just did.

🌳 Watch BFS in Action

Here's the exact same strategy, on a simple tree this time. Press play and watch the order it lights up in.

Press play to begin.

This is Breadth-First Search (BFS)! Here's what you just discovered in the house:

You (the searcher)β†’ the algorithm doing the traversal
A Room→ a node in the graph
A Doorway / Staircase→ an edge connecting two nodes
"Only nearby rooms glow"β†’ only unvisited neighbours join the frontier
Checking all rooms on a floor first→ visiting every node at the current level before the next

This level-by-level strategy is exactly why BFS always finds the shortest path in an unweighted graph: nothing farther away is ever checked before everything closer has been. πŸŽ“

🧭The Strategy+
Check every room nearby before going farther. You never skip ahead to a room two floors up while ground-floor rooms are still unchecked. This is what "breadth" means in Breadth-First Search: spreading outward evenly, one full ring at a time.
πŸ”’The Queue+
Those "options from here" chips were a real queue the whole time. New discoveries always joined the back of the line, and the room you were allowed to check next always came from the front. That First-In, First-Out (FIFO) rule alone is what guarantees the level-by-level pattern.
βœ…Marking Visited+
Every room you checked was locked in as visited, so it never glowed again. Without that, a room could be added to the queue more than once, and in a graph with cycles the search could loop forever.
πŸ“Why It's the Shortest Route+
Because every room on a floor is fully checked before any room on the next floor even joins the queue, the very first time you reach a room is guaranteed to be by the shortest possible path from the Front Door, as long as every step (every doorway) costs the same.
🌍Where You'll See It+
Shortest-route finders, "people you may know" suggestions, web crawlers, network broadcast alerts, and countless puzzle solvers all lean on this exact breadth-first idea: spread outward one full layer at a time.
βš–οΈWhere It Breaks Down+
BFS assumes every connection costs the same one step. The moment some doorways are "farther" than others (different costs), checking rooms in discovery order no longer guarantees the shortest route, a different strategy is needed.
Chapter 6 Β· Trial Rooms

Put the idea to the test

New situations to think through using what you just discovered.

1 Β· New ProblemA rescue team needs to find the nearest safe room in a building. The building has many connected rooms, and moving through each corridor takes one step. How could you organize the search so that nearby rooms are checked before farther rooms?
2 Β· Recognize the PatternA search starts from one location and explores all locations one step away before moving to locations two steps away. What features of a problem would make this type of search useful?
3 Β· Choose an ApproachYou need to find a target in a graph where every connection has the same cost. Would you prefer to explore one path deeply or explore locations level by level? Explain your choice.
4 Β· Spot the MisconceptionSomeone says, "BFS always gives the shortest path because it visits every vertex." What is wrong with this reasoning?
5 Β· Change the ConstraintsBFS is being used to find the shortest route, but now different connections can have different costs. How might this change your choice of search strategy?
6 Β· Compare EfficiencyTwo searches explore the same graph. One explores locations level by level, while the other follows one path as far as possible before backtracking. What factors would you examine to decide which search is more suitable for a particular problem?
7 Β· Unfamiliar ApplicationA communication network has several starting points where an alert is detected at the same time. The company wants to know how quickly the alert could reach every other device. How could a level-by-level search help, and what would determine how efficiently it works?