Benchmarking LLM Coding Ability: Using a Mini-Game Generation Task to Evaluate Coding Agents
When evaluating the coding ability of large language models, simple algorithm exercises reveal little about real-world capability. This article uses a "build a playable 2D basketball mini-game from scratch" task to compare two leading LLMs, examining task completion, interactive integrity, visual and physical correctness, and regression behavior during iterative bug fixing. The article distills four practical evaluation dimensions, introduces a "regression rate" metric, and offers actionable advice on model selection, automated acceptance testing, and human-AI division of labor for developers choosing coding agents.
Benchmarking LLM Coding Ability: Using a Mini-Game Generation Task to Evaluate Coding Agents
1. Why “Build a Mini-Game” Is a Good Test
When evaluating the coding ability of large language models (LLMs), many developers default to tasks like “write a quicksort” or “implement a utility function.” These tasks involve little code and well-defined boundaries, so they rarely distinguish real capability. In contrast, a comprehensive task like “generate a playable basketball mini-game from scratch” naturally covers multiple competency dimensions:
- Requirements understanding and task decomposition: The model must understand basketball rules—dribbling, passing, shooting, stealing—and translate them into executable program logic.
- Multi-module coordination: A complete game involves rendering (court, hoop, players), physics simulation (ball trajectory, collisions), state management (score, turns, win/loss determination), and interaction control (keyboard/button input).
- Correctness and completeness: A single broken logical link can make the game entirely unplayable—a failure mode that single-function tests rarely expose.
- Iterative fixing ability: Code is rarely correct on the first try. Whether the model introduces new bugs during multi-round debugging, or makes things worse with each “fix,” is a key measure of its engineering practicality.
I recently ran this type of task against two mainstream LLMs (referred to below as Model A and Model B). This article abstracts my observations into general evaluation dimensions and conclusions.
2. Observed Behaviors
2.1 Wide Gaps in Task Completion
Both models were given the same task: generate a 2D basketball mini-game with player movement, shooting, passing, and stealing mechanics, plus scoring and a basic UI.
- Model A: In two independent runs, it failed to deliver a complete, playable version. Before any fixes, the game couldn’t even reach the start state—players didn’t move, and none of the controls shown at the bottom (shoot on Z, pass on X, steal on C) responded. Even after multiple rounds of guided debugging, the result was judged a failure.
- Model B: Delivered a basically runnable version. Players could move, a built-in commentary system reported game events in real time, and it even included an Auto mode that simulates a full game automatically (though the gameplay isn’t much to watch). However, it had clear visual defects: the basketball hoop position and court lines were inaccurate, and players moved too fast.
2.2 “Collapse-Style” Regressions During Iterative Fixing
Model A exposed a classic and dangerous problem: fixing one bug broke previously working functionality. In one case, after asking the model to fix a court rendering issue, every player entity on the court disappeared—a textbook regression defect.
This suggests the model lacks stable control over the global state across multi-turn conversations. It tends to apply local patches based on the latest feedback rather than maintaining a coherent overall code structure. For real engineering, this “whack-a-mole” fixing pattern is more destructive than simply getting it wrong the first time.
3. Four Evaluation Dimensions
Based on this test, I recommend breaking “mini-game generation” tasks into four operational dimensions:
3.1 Runnability (The First Gate)
Can the game start, and does the core loop run? This is a hard requirement. A beautifully rendered product that never starts should score zero.
3.2 Interaction Completeness
Do all declared input channels (keyboard keys, buttons, clickable areas) actually work? A common failure mode: the model generates UI elements and event listener code, but the event bindings are never wired into the game’s state machine—producing “buttons that look real but do nothing.”
// A typical fake interaction: the listener exists, but state never drives the game logicwindow.addEventListener('keydown', (e) => {if (e.key === 'z') {shoot(); // if e.g. the possession state that shoot() depends on was never initialized, the call silently fails}});
3.3 Visual and Physical Correctness
Do court lines, hoop position, and ball trajectories match common sense? Model B was playable overall, but the hoop coordinates were inconsistent with the ground perspective and the movement-speed coefficient was too large—showing that numerical parameter sanity still needs human tuning.
3.4 Stability of Iterative Fixing
This is the dividing line between “demo-grade” and “engineering-grade” coding agents. Possible evaluation methods:
- Track the number of passing test cases after each fix round and check whether it increases monotonically;
- Add lightweight regression checks (e.g., screenshot comparison, assertions on key elements) that run automatically after each round;
- Require the model to output a change-scope description before modifying code, constraining it to “only change what’s necessary.”
4. Practical Advice for Developers
- Use comprehensive tasks, not toy tasks, for model selection. Many models pass single-function tests; only those that stay stable across multi-round fixing are suitable for daily work.
- Build automated acceptance scripts. Mini-game tasks are well suited to headless browsers plus screenshot assertions for automated acceptance, avoiding inefficient manual click-through rounds.
- Include “regression rate” in your metrics. For example: regression rate = (previously working features broken during fixing) / (total features). Model A’s core problem was precisely a high regression rate.
- Keep the human-AI division of labor clear. In this test, even the better model needed developer involvement for parameter tuning (movement speed) and visual alignment (court lines and hoop position). Treating the model as “an assistant that quickly scaffolds” while humans polish the details is the more realistic workflow today.
- Use cloud infrastructure to support the evaluation pipeline. If you want to run these evaluations regularly within a team, you can standardize task distribution, artifact hosting, and screenshot assertions on cloud object storage, container platforms, and CI services, forming a sustainable benchmarking pipeline.
5. Conclusion
The core finding of this comparison: current LLMs have a workable foundation for generating a runnable mini-game in one shot, but the gap between models in iterative-fixing stability is far larger than the gap in first-pass generation. Model B delivered a structurally complete version with commentary and an auto-demo mode; its defects were concentrated in visual parameters—easy surface-level fixes. Model A exposed deeper problems: broken interaction chains and regressions introduced during fixing.
For developers, rather than agonizing over “which model is absolutely better,” it makes more sense to build your own multi-dimensional evaluation baseline, using comprehensive tasks, automated acceptance testing, and regression-rate metrics to quantify each model’s strengths and weaknesses, then make your selection based on your own workflow. This is a new fundamental skill for developers in the LLM era: if you can evaluate, you can use models well.
