Search algorithms

We wanted machines to think. Early on, that meant figuring out how they’d search. Not the web—just possible moves, states, or steps. The trick was deciding what to try first.

Breadth first

Breadth-first search checks every option one step out before moving deeper. It’s tidy and predictable. We always find the shortest path this way. But it eats memory like candy if the space is wide.

Depth first

Depth-first search dives straight down one path, then backtracks when it hits a wall. It’s leaner on memory, though sometimes it wanders forever. Think of it as the friend who insists “just one more block” instead of checking the map.

Heuristics

We added hints—heuristics—to cut the wandering. A heuristic is a guess about which choice is closer to the goal. Even a bad one can help. A good one can make search feel smart.

A*

A* combines both: it looks at the cost so far plus the guessed cost to go. She keeps the paths in a queue, sorted by this score. That’s why she usually finds the best route fast, as long as our guesses aren’t wild.

Why it mattered

These algorithms were our first stabs at teaching machines to “plan.” They powered puzzles, mazes, and games. They showed us that a little structure and a few guesses could make her look clever.

We like how tidy A* feels. But sometimes we wonder if we’re still just dressing up guesswork with math.