Evaluating LLM Coding Capabilities Through Basketball Game Generation

    Generating a basketball game can reveal how well a large language model handles requirements, interaction, state management, and debugging—but visual polish alone is not a reliable measure of coding ability. This article explains how to define acceptance criteria, diagnose common failures, test complete gameplay workflows, and assess iterative repairs under consistent evaluation conditions.

    1. Define What “Better” Means Before Evaluating a Coding Model

    Asking a large language model to generate a small basketball game may seem like a lightweight development task. In practice, it combines requirements interpretation, interface layout, input handling, motion simulation, rule implementation, and defect repair. It is useful for observing whether a model can organize multiple components into a working system, but it cannot represent the model’s full capabilities on its own.

    One generated game might render a detailed basketball net but fail to start. Another might look rough yet allow players to move and an automated match to run continuously. These results reflect different dimensions of capability. Neither an attractive screenshot nor a single execution is enough to establish overall model superiority.

    A more useful evaluation starts with the intended deliverable. For a playable prototype, successful startup, working controls, and a complete gameplay flow should take priority. For a scene illustration, visual layout is the main criterion. Evaluation standards must match the delivery goal rather than change after the results are available.

    A small number of tests also provides only a limited view. Generation is nondeterministic, and results can depend on the wording of requirements, context length, repair prompts, and runtime environment. Conclusions should therefore describe performance “under the specified task, environment, and testing budget,” rather than claim that one class of models is universally better.

    2. Identify the Technical Problems Behind Common Failures

    Detailed Rendering Does Not Mean the System Is Complete

    Visible elements such as nets, court lines, and player outlines naturally attract attention. Whether the game actually works, however, depends on whether those elements align with its rules and interactions.

    A basket involves at least three related concerns:

    • Rendered position: Where the player sees the basket on screen.
    • Scoring region: Where the program determines whether a shot scores.
    • Scene semantics: Whether the basket aligns with the baseline, court orientation, and attacking direction.

    If the rendered position and scoring region do not match, the ball may visibly pass through the hoop without scoring, or a shot outside the hoop may count as a basket. Visual detail demonstrates local rendering quality, not end-to-end correctness.

    Failure to Start Usually Indicates a Broken Critical Path

    An unresponsive Start button and a player who cannot move may look like similar failures, but their causes can differ. Common checks include:

    • Is the button’s event handler bound correctly?
    • Is a transparent overlay intercepting input?
    • Does clicking Start actually transition the game into the playing state?
    • Does the update loop start and continue running?
    • Does scene initialization throw an error?
    • Are input events recorded but never passed to player-control logic?

    Debugging should follow the sequence input → event handling → state change → scene update → rendered output. Randomly changing player speed or interface styling does not establish where the failure occurs. Even if a symptom disappears, the underlying problem may remain.

    Players Disappearing After Repairs Signals Regression Risk

    If repeated repairs cause every player to disappear, that is more than a cosmetic issue. The entity collection may have been cleared incorrectly, initialization logic may have been overwritten, rendering conditions may have changed, or position updates may have moved players outside the visible area.

    This illustrates two requirements for repair quality:

    1. The target defect must be resolved.
    2. Previously working features must continue to work.

    A model focused only on the current error may delete related logic to suppress it while breaking the broader gameplay flow. “The error no longer appears” and “the defect is fixed” are not the same outcome.

    A Running Automated Match Does Not Prove Rule Completeness

    An automated mode that runs continuously shows that the update loop and some behavior logic are operational. It does not prove that the game is complete.

    Further checks are necessary: Is possession clearly defined? Is there only one ball carrier? Does the game reset correctly after a score? Do players remain within bounds? Does shooting follow an explainable scoring rule?

    Without these constraints, an automated match may be little more than several objects moving around rather than a valid game simulation.

    3. Turn Vague Requests into Testable Specifications

    A common problem with model-generated software is that the prompt says only “build a basketball game,” without defining what completion means. The model may add complex features on its own while omitting basic controls.

    Before development, define a minimum usable scope:

    1. The scene includes a court, baskets, a basketball, and recognizable players.
    2. The user can start, pause, and restart the game.
    3. At least one player supports manual movement.
    4. Shooting, passing, and stealing have explicit trigger conditions.
    5. The score updates when a valid basket is made.
    6. Automated mode runs continuously and can be exited.
    7. The instructions match the actual controls.

    “A button can be clicked” is not a complete functional requirement. Passing, for example, needs more precise conditions: only the ball carrier can pass; a valid recipient must exist; the original carrier loses possession after passing; and the recipient gains possession when the pass completes.

    The closer requirements are to observable behavior, the easier tests are to reproduce—and the less likely a model is to confuse generating an interface with implementing a feature.

    4. Organize Gameplay with a State Machine

    Even a small game needs explicit state management. The match can be divided into states such as ready, playing, paused, and finished, with each state permitting only the relevant operations.

    For example:

    • Ready: Allows the match to start without updating player positions.
    • Playing: Allows movement and gameplay actions while continuously updating the scene.
    • Paused: Preserves current data but stops the game clock and motion updates.
    • Finished: Displays the result and offers a restart option.

    This structure reduces conflicts between multiple Boolean flags. Otherwise, flags such as “started,” “paused,” and “finished” may all be true at once. The interface may appear correct while different conditional branches block the actual actions.

    Match state should also be separate from entity state. A player may be carrying the ball, moving, or waiting. The ball may be held, in transit during a pass, or in flight during a shot. Once the ball enters a flight state, it should no longer remain attached to the carrier’s hand. After a pass completes, it should not belong to two players simultaneously.

    5. Separate Input, Updates, and Rendering

    The Input Layer Expresses Action Intent

    Keyboard controls and on-screen buttons should map to the same set of actions, such as movement, shooting, passing, and stealing, rather than implement separate rules.

    This avoids a situation where a button invokes one logic path and the keyboard invokes another, leaving one input method functional and the other broken.

    Continuous movement and discrete actions also need different handling. Movement can read a sustained pressed state. Shooting should generally execute on a distinct trigger so that holding a button does not repeatedly submit the same action.

    The Update Layer Changes State

    Player movement should depend on elapsed time rather than a fixed distance per refresh:

    Displacement = speed × elapsed time

    With fixed per-refresh movement, the same game can run at noticeably different speeds on devices with different refresh rates. After a long interruption, the time interval for a single update should be limited, or updates should use a fixed time step, to prevent objects from suddenly jumping across collision regions.

    Speed, time-step size, and limits must be determined through testing and actual gameplay. Unverified parameter values should not be presented as universal standards.

    The Rendering Layer Displays Current State

    Rendering should read player, ball, and court data without changing scores, possession, or entity counts. Otherwise, resizing the window, drawing the scene again, or changing display states could unintentionally alter gameplay logic.

    Court layout should also use a shared coordinate system. Basket positions, boundary lines, scoring regions, and player movement limits should derive from the same scene configuration. This reduces inconsistencies caused by defining coordinates separately.

    6. Build a Test Checklist That Covers the Full Workflow

    Testing should begin with the shortest usable path, not with complex gameplay actions.

    Level 1: Startup and Basic Controls

    Verify that the page displays correctly, the Start button works, players appear, and movement responds to input. If these checks fail, stop evaluating advanced rules: later features do not yet have a working foundation.

    Level 2: Individual Actions

    Test shooting, passing, and stealing separately, including behavior when their preconditions are not met. For example, a player without possession who attempts to shoot should receive an appropriate message or have the action ignored—not cause a second basketball to appear.

    Level 3: State Transitions

    Check that pausing stops player movement, resuming continues the game, and restarting resets the score and possession.

    Pay particular attention to repeated restarts. They may create duplicate event bindings, causing one click to trigger several actions.

    Level 4: Continuous Operation

    Run automated mode continuously and watch for a missing ball, out-of-bounds players, incorrect scores, or a stopped update loop. Continuous testing exposes cumulative problems that isolated clicks may not reveal.

    Level 5: Regression After Repairs

    After every repair, rerun basic controls and critical state-transition tests. Neither new features nor defect fixes should be exempt from regression checks.

    7. Evaluate the Model’s Iterative Repair Ability

    To assess repair ability, provide specific, reproducible feedback rather than simply saying “it still does not work.”

    A useful defect report should include:

    • Steps to reproduce.
    • Expected behavior.
    • Actual behavior.
    • Visible errors or runtime logs.
    • The scope of changes allowed in the current repair round.

    For example:

    After starting the match, clicking Pass leaves the ball at the original carrier’s position. The expected behavior is for the ball to travel to a valid teammate and transfer possession when the pass completes.

    For each round, record whether the target problem was resolved, whether new problems appeared, and whether the scope of changes was appropriate.

    Repeatedly rewriting the entire program may eventually restore functionality by chance, but it offers limited evidence that the model located the defect accurately. Stronger repair behavior includes explaining the cause, making a localized change, and adding checks that help prevent the same failure from recurring.

    8. Form Reliable Conclusions About Coding Capability

    When comparing model-generated implementations, keep requirements, runtime environments, available dependencies, attempt counts, and repair budgets consistent.

    Retain both the initial output and the final repaired version. These reveal different capabilities: first-pass delivery and iterative improvement.

    Evaluation criteria can include:

    • Functional completeness: Are the agreed features implemented?
    • Executability: Can the game start, run a match, and reset?
    • Interaction correctness: Do controls produce the expected results?
    • State consistency: Do possession, scores, and entity relationships obey the rules?
    • Repair stability: Do fixes introduce regressions?
    • Maintainability: Is the structure clear, and are the effects of changes manageable?
    • Visual consistency: Do rendered scene elements align with the corresponding rule regions?

    For a playable prototype, establish critical acceptance gates first. A result that cannot start or respond to controls should not receive a “deliverable” rating solely because it looks impressive. Once those gates are passed, compare layout quality, simulation behavior, and code organization.

    The value of basketball game generation is not in assigning a simplistic “strong” or “weak” label to a model. It is in testing whether the model can complete a full development cycle: understand requirements, establish a structure, implement rules, support interaction, diagnose defects, and preserve existing functionality. Only when that cycle survives repeated testing and explicit acceptance checks does generated code begin to resemble usable software delivery.