game Β· 2 min

Syntax Asteroids

Real Python snippets fall toward main and roughly half of them are famous gotchas. Blast the bugs, merge the clean code, and find out whether your code-review reflexes survive a rising deploy velocity. Three bugs in prod and the pipeline is yours to explain.

Sixteen snippets, every one of them lifted from the Python hall of fame: the mutable default argument, the late-binding lambda, nums = nums.sort(), the [[0]*3]*3 grid that shares one row three ways. Each asteroid drifts toward the main branch and you get one decision per rock β€” vaporize it or let it merge.

Blasting a bug pays +100 and tells you exactly why it was a bug. Blasting working code costs βˆ’80 and the lesson stings more, because that None-sentinel default you just deleted was the fix. Every gotcha in the deck was verified by actually running it: sum([0.1]*3) really does miss 0.3 by 5.5e-17, and removing from a list mid-iteration really does let a 2 slip through. The game over screen replays the lessons from everything you got wrong, which is more than most postmortems manage.

If you’d rather lose to physics than to CPython, Gravity Courier is one door down. Best score saved to localStorage. Single HTML file, no dependencies.

← all games