
Hill Climbing
Hill Climbing
From Hand Calculations to AI-Assisted Code
You can already ask an AI to write you a Hill Climber. The problem is knowing why it stopped — because Hill Climbing always stops, confidently, at the top of whatever hill it happened to be standing on, with no way of telling whether that's the highest peak or a small bump beside the real one. Understanding exactly when and why that happens is the foundation under every more advanced search method you'll ever use. This is the course that gives you that judgment.
Five parts, one algorithm, no gaps:
Part 1 — Intro. How the simplest possible search — always step to a better neighbor, stop when none is better — solves a surprising range of problems, and why the same simplicity that makes it fast is exactly what gets it stuck. The intuition before the notation.
Part 2 — By Hand. A complete worked example, step by step: evaluate the neighbors, move to the best one, and repeat until you're at a peak — every candidate and every number shown. You'll also walk it straight into a local optimum on purpose, so you see the trap form. Nothing waved away, nothing left "as an exercise." You prove the algorithm to yourself.
Part 3 — In Excel. The same example built out in a spreadsheet you can open and poke at, so you watch the climb — and see for yourself how a different starting point lands you on a completely different peak.
Part 4 — In Python. A clean, executable, verified reference implementation — the known-good version you can check any other code against, including the random-restart variant that turns a fragile climber into a genuinely useful one.
Part 5 — With AI. A tested prompt that directs an AI assistant to carry this same algorithm to your problem, plus the understanding to catch it when it's wrong.
By the end you won't just have working code. You'll have followed the algorithm from first principles through a hand calculation, a spreadsheet, and production Python — so when you point an AI at your own optimization problem, you'll know why starting point and neighborhood define everything, when a simple climber is genuinely enough, and when you need to reach for something stronger.
Written for practicing engineers and STEM professionals who'd rather understand a method than trust a black box.