Whatever you're looking for, a computer has probably thought harder about how to look than you have.
Everybody is searching for something. A better job, a better partner, the right apartment, the right next move. We spend huge stretches of life looking, and mostly we do it the way a rat does a maze: pick a direction, go until we hit a wall, back up, try again. It works. It's also slow, and full of dead ends.
Here's what computer scientists noticed: searching a maze, searching for a job, and searching for the fastest way to work are, underneath, the same problem. You're here, you want to be there, and there are a lot of wrong turns in between. See that shape, and you can stop asking "how do I get lucky" and start asking "how do I search well?"
That depends almost entirely on one thing: what you do with the walls you hit.
First, a distinction people get wrong. This isn't a labyrinth. A labyrinth has one winding path and no choices — you can't get lost in one, which makes it lovely for meditation and useless for us. A maze has branches, dead ends, and the ability to beat you. That's what makes it worth solving. (If you've been using the words interchangeably your whole life, don't feel bad. You're in a-maze-ing company.)
One more thing before we let them loose. These three searchers aren't running the maze. They're studying it — standing at the entrance, working out where to go before committing a step. What lights up on screen isn't footprints. It's where each one is putting its attention.
The thorough rat (call it Breadth-First) is relentless and a little obsessive. It won't consider anywhere two steps out until it has considered everywhere one step out first, fanning outward in perfect rings. It always finds the path with the fewest steps. It just considers half the maze to do it, because it has no idea which way the cheese is and refuses to guess. One more thing about the thorough rat: it doesn't feel the ground. Rough terrain and smooth corridors look exactly the same to it. It counts steps. That's the whole metric.
The careful rat (Dijkstra) is the thorough rat's smarter cousin. It also fans outward, but it knows not every step costs the same — some corridors are long, some short, some uphill. So it always reaches toward wherever the cheese is cheapest to get to so far. On a plain maze it acts just like the thorough rat. Give the maze real terrain, and it starts making genuinely wise choices. Still no clue where the cheese is, though.
The smart rat (A*) has something the others don't: it can smell the cheese. The walls still block it and the dead ends still fool it, but at every fork it has a rough sense of which way the goal lies, and it leans that way. It weighs how much effort got it here against a guess of how far's left. That guess — the smell of cheese — has a name: a heuristic. It's the whole difference between wandering and searching.
Three rats, one maze, one clock. Watch them think.
Notice what all three rats had in common. They all hit walls. The smart rat wasn't the one that avoided dead ends — it was the one that learned from each one and let it sharpen the next guess. There's no version of the search where you don't hit walls. There's only what you do with them.
And you are running this exact search right now, in your career, your relationships, the whole long project of figuring out what you want and how to reach it. Nobody gets the straight path. Everybody hits walls. Everybody backs up.
Notice, too, what the thorough rat didn't notice: the ground. It found the shortest route by steps — and it is genuinely shorter. But it walked straight through the rough terrain without registering it was there. The careful rat took a few extra steps and arrived in better shape. Shortest and cheapest are different questions, and it matters which one you're actually trying to answer. The shortest path to a new job might run straight through a role you'll hate, at a company that's wrong for you, building skills you have no use for. The thorough rat takes it. The careful one goes around.
And then there's the thing the smart rat has that neither of the others can buy: a direction. Not a map — it doesn't know the route. Not a guarantee — the walls still fool it, the dead ends still catch it. But it leans toward the goal with every single step, and that lean is the difference between searching and wandering. BFS and Dijkstra discover the destination. A* already knows it's there.
So here's the one thing worth taking from three rats in a maze:
A dead end that teaches you where not to go next has done its job. That isn't failure. That's the search working exactly as it should. So wander if you have to — everyone does. Pay attention to the terrain. And if you can, know where you're going.