AI Coding Assistants Tested: From Bare Metal to a Working Game
A hands-on comparison of two AI coding assistants examines their ability to build and debug games in a bare-metal environment. The initial development attempts and a follow-up code rescue reveal the gap between well-structured code and working systems, including a firmware pointer-lifetime bug diagnosed through serial logs. The experiment highlights why environment setup, runtime debugging, and human-guided feedback matter in evaluating AI coding tools.
1. Why Test AI Coding Assistants with a Bare-Metal Game?
A common way to evaluate an AI coding assistant is to ask it to build a web page or solve algorithm problems. These tasks are well represented in training data, making it difficult to distinguish genuine reasoning from reproduction of familiar patterns.
A more demanding test uses an environment with fewer available examples and little tolerance for mistakes: building a Breakout-style or Tetris-style game on a machine without an operating system, using firmware interfaces to initialize graphics.
This creates three major challenges:
- No ready-made runtime. There is no libc, debugger, or graphics library. Output depends on firmware-provided protocol interfaces and serial logs.
- Errors can cause immediate failure. There is no conventional exception report or stack trace to inspect. A misused pointer can leave the machine silently restarting or displaying a black screen.
- The build environment is itself a hurdle. The cross-compilation toolchain, linker script, and image format must all be configured correctly before execution can begin.
These constraints make the task a useful test of end-to-end engineering ability. The assistant must do more than produce plausible code: it must set up the environment and uncover failures with limited visibility.
2. First Comparison: Similar Difficulty, Very Different Outcomes
I began with a simple comparison: ask two different AI coding assistants to build a small game with Chinese character rendering in a bare-metal environment.
Assistant A: A Working Game in About Two and a Half Hours
Assistant A maintained a clear sequence throughout the task. It first checked whether the firmware graphics protocol was available, then implemented character rendering, and finally built the game loop.
The resulting project compiled successfully on the first attempt and ran when the machine was powered on. The Chinese character rendering and collision logic both worked. I did not intervene with any manual debugging.
Assistant B: Nearly Six Hours Without a Working Build Environment
Assistant B was given a different game of similar complexity. After nearly six hours, it had still not established a working compilation environment.
Its code, however, was not obviously poor. The project contained seven source files, with separate modules for the entry point, main loop, rendering, and input. Naming was consistent, and the structure was clear. Viewed in isolation, it resembled code written by an experienced systems programmer.
The failure was in making that code run. Toolchain selection, linker layout, and the sequencing of firmware calls all proved troublesome—details that are rarely covered completely in textbook examples.
The comparison exposed an important distinction: writing code that looks correct and bringing a system into a working state are different abilities. Models can learn code organization from large amounts of open-source material. Debugging experience that is sparse and dependent on specific hardware behavior is a more revealing differentiator.
3. Second Experiment: Can One AI Repair Another AI’s Code?
Some readers pointed out that giving the assistants different tasks made the comparison less fair. That criticism was reasonable.
I therefore ran a follow-up experiment. I copied Assistant B’s well-organized but nonfunctional code into a fresh environment without modifying it, then asked Assistant A to make it work.
The work was divided into two rounds: first, get the program running; second, refine and optimize it. The debugging sequence below covers the effort to reach the first goal.
3.1 Start with a Code Review
My first instruction was straightforward:
“Review this code and identify issues that could prevent it from running.”
Assistant A read through the entry point, main loop, game logic, rendering module, and input handling. Within a few minutes, it produced a list of potential problems, including a questionable graphics-mode query and an unsuitable initialization order.
It claimed that correcting those issues would make the program run.
3.2 The Program Started—and Then Exited
After compilation and launch, the log displayed:
Starting Game Loop
Then the program exited immediately.
That was progress compared with Assistant B’s inability to reach execution, but it was still far from a usable game.
This is a familiar problem in bare-metal development: instead of producing a useful crash report, a program can simply disappear.
I asked Assistant A to add more detailed serial debug output along critical execution paths so that we could track progress through the program.
3.3 Finding the Root Cause: A Stale Pointer
Using the serial logs, Assistant A narrowed the failure down to the point immediately after a firmware graphics protocol call.
Further analysis identified a pointer-lifetime problem.
The code queried display-mode information and retained a pointer to it. It then switched display modes. In this implementation, the mode switch invalidated the memory referenced by the previously obtained pointer: the underlying data structures were rebuilt during the transition.
The code continued to dereference that old pointer after the mode switch. It read invalid data, and the program exited abnormally.
The fix was to retrieve the framebuffer information again after switching modes, obtain a valid pointer, and only then continue initialization.
The following pseudocode illustrates the ordering issue rather than a specific firmware API:
// Incorrectmode_info = query_mode_info(...);set_mode(target_mode);fb = mode_info->framebuffer; // The old memory is no longer valid.// Correctset_mode(target_mode);mode_info = query_mode_info(...); // Retrieve valid information after the switch.fb = mode_info->framebuffer;
After this change, the program stopped exiting unexpectedly, and the game display appeared.
4. Four Lessons from the Experiment
1. Evaluate Code Quality and Engineering Execution Separately
Module boundaries and consistent naming are abilities that models can learn from abundant code examples. Both assistants demonstrated competence in those areas.
The larger difference appeared in environment setup and runtime debugging—tasks that require interaction with a real system.
A polished codebase is therefore not sufficient evidence that an assistant can deliver a working application.
2. AI Can Repair AI-Generated Code, but Human Guidance Still Matters
Assistant A successfully took over Assistant B’s code and repaired it. However, it did so with a clear objective—get the program running first—and an observation mechanism: serial logs.
The division of labor was practical. The human provided the environment and feedback loop; the assistant performed the analysis and code changes.
This was a guided recovery, not a demonstration of fully independent debugging.
3. Classic Systems Bugs Do Not Disappear When AI Writes the Code
A protocol-query result becoming invalid after a state transition is a recurring lifetime issue in driver and firmware development.
It is not surprising that an AI assistant can make such a mistake. Simplified examples may omit the need to retrieve information again, and a model can reproduce those incomplete patterns.
The practical lesson is clear: when using AI to write low-level code, humans still need to review resource and pointer lifetimes carefully.
4. Evaluation Should Include Difficult Recovery Tasks
Building a working demo and repairing someone else’s broken implementation test different levels of capability.
The latter more closely resembles everyday engineering work, which often involves understanding and modifying an existing codebase rather than starting from scratch.
Including these recovery tasks makes evaluations more useful when choosing an AI coding assistant for real projects.
Conclusion
This experiment suggests that AI coding assistants have moved beyond merely producing structurally sound systems code and are approaching the ability to bring real systems into a working state.
Those are distinct milestones. The first draws heavily on learned code patterns; the second depends on reasoning and effective use of feedback.
In this comparison, that second capability produced the largest difference between the assistants—and remains the most important area to watch.
