Bug Hunt
Tap Run, then tap the line with the bug. Desktop: R to run, arrow keys and Enter to pick a line, H for a hint.
What is Bug Hunt?
Bug Hunt is a free debugging game where you read a short program and find the one line that breaks it. Beginners think programming is writing code; in practice it is mostly reading code that does not work and finding out why. Each puzzle gives you the three things a real bug report gives you - what the program should do, what it actually does, and the source - and one line is wrong. The bugs are the genuinely common ones rather than typos.
How to play Bug Hunt
Controls: Tap Run, then tap the line with the bug. Desktop: R to run, arrow keys and Enter to pick a line, H for a hint.
- 1Pick Trainee for short programs or Engineer for the trickier classics.
- 2Press Run to test the program. The terminal shows what it printed next to what the test expected.
- 3Watch the yellow arrow step through the code and the Variables panel change as each line runs.
- 4Tap the line that causes the bug. A red breakpoint dot marks your pick.
- 5Watch the fix get typed in and the test turn green, then read why it was a bug.
- 6Stuck? Tap Hint. Bugs found on the first try score 3 points.
Bug Hunt tips and strategy
- Let the symptom point you at the line. If a total ends up equal to the last item, look at how the total is updated, not at how the loop is set up.
- Check every comparison twice. A greater-than that should be a less-than is the single most common bug in this game and in real code.
- When a loop runs one time too few or too many, count carefully from zero. Three items starting at index 0 means 0, 1 and 2, so the condition has to be 'less than 3'.
- A return inside a loop stops everything immediately. If the code gives up after checking only the first item, that is usually why.
Bug Hunt FAQ
What is debugging?
Finding and fixing the reason a program behaves differently from how you intended. It usually means comparing what the code says to what you meant line by line, forming a theory about which line is wrong, and testing that theory - which is exactly the loop this game drills.
What is an off-by-one error?
A bug where a loop runs one time too many or too few, almost always because counting starts at zero rather than one. It is so common in programming that it has its own nickname, and one whole puzzle in this game is dedicated to it.
Do I need to know a programming language to play?
No. The programs are short, real Python - a few lines each, like 'for price in basket:' and 'total = total + price'. The goal is written in plain English at the top and you can watch every variable change as the code runs, so you can follow along without having learned any language first. The reasoning transfers to every real language.
Is Bug Hunt good for learning to code?
It builds the half of coding that tutorials tend to skip. Following a worked example teaches you syntax, but reading broken code and working out why it is broken is the skill you actually spend your time on, and it is much easier to practise in short puzzles than in a large project.