Testing AI Coding Assistants on a Hard Problem: Building a Chinese Breakout Game That Runs in UEFI Shell

    A hands-on evaluation of AI coding assistants using an unconventional benchmark: writing a graphical Breakout game with Chinese text rendering that runs directly in UEFI Shell, with no operating system underneath. This article covers the test design, framebuffer rendering, bitmap font handling, non-blocking input, and an honest assessment of where AI coding tools excel and where they still fall short.

    Why I Chose Such a “Tricky” Test Task

    Evaluating an AI coding assistant with a “Hello World”-style task proves nothing. What truly reveals a tool’s capability boundaries is a task that requires integrating knowledge across domains. My goal was this: build a graphical Breakout game that runs under UEFI Shell with Chinese text support. In plain terms, a program you can copy to a USB stick, plug into a computer, launch from the BIOS Shell, and play.

    The task looks simple, but it touches nearly every hard problem in system-level programming:

    • No operating system support: The UEFI environment has no process scheduling and no full standard C runtime. Memory allocation, screen output, and keyboard input all go through firmware-provided interfaces.
    • Non-standard graphics: No common graphics libraries are available. You must query the graphics output protocol directly to get the framebuffer and implement pixel drawing yourself.
    • Chinese display is its own challenge: The firmware environment loads no font resources by default, so parsing and rendering a bitmap font has to be implemented from scratch.
    • Complete game logic: Breakout involves graphics rendering, user input, collision detection, and state management—core programming elements with a clear structure. It has been my classic benchmark for programming ability for years.

    An important design consideration: the task simultaneously tests the tool’s knowledge depth (does it understand firmware development conventions), code organization (can it generate a complete, well-structured program in one pass), and debugging reasoning (when something breaks, can it point in the right direction).

    Setting Up the Development Environment

    An application that runs under UEFI Shell must be built as a standard firmware application. The core pieces of the project are:

    1. A module definition file: declares the application type as a UEFI application and specifies the entry function.
    2. A build description file: organizes the compilation of sources and libraries.
    3. Entry code: initializes at the image entry point and obtains the service pointers from the system table.

    A typical entry framework looks like this:

    1. EFI_STATUS EFIAPI UefiMain (
    2. IN EFI_HANDLE ImageHandle,
    3. IN EFI_SYSTEM_TABLE *SystemTable
    4. )
    5. {
    6. // Initialize graphics output, simple file system, and other protocols
    7. // Enter the game main loop
    8. GameMain();
    9. return EFI_SUCCESS;
    10. }

    The AI coding tool performed well at this step: it accurately recalled the basic structure of a firmware application, and the generated project skeleton compiled directly. This suggests that for standard frameworks with ample documentation and community discussion, these tools have solid knowledge.

    Graphics Rendering: Drawing Every Frame from the Framebuffer

    In UEFI, graphics capability comes from querying the graphics output protocol for the display mode, then grabbing the framebuffer base address and the per-scanline stride:

    1. EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
    2. SystemTable->BootServices->LocateProtocol(
    3. &gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
    4. UINT32 *FB = (UINT32 *)Gop->Mode->FrameBufferBase;
    5. UINT32 Pitch = Gop->Mode->Info->PixelsPerScanLine;

    On top of this, I wrapped a DrawRect(x, y, w, h, color) function that writes pixels row by row, column by column. The game uses a simplified double-buffering mindset: each frame starts by clearing the screen with the background color, then draws the bricks, paddle, and ball. There is no real vertical sync, but in a Shell environment a simple scene at 60 FPS looks fine to the naked eye.

    Modeling the Breakout entities is not complicated:

    • Bricks: a 2D array tracks alive/dead status, with different colors per row.
    • Paddle: a horizontal rectangle whose position is controlled by the left/right arrow keys.
    • Ball: stores coordinates and a velocity vector, moving along the vector each frame.

    Collision detection uses classic axis-aligned bounding box tests: when the ball intersects a brick, the corresponding velocity component is reversed and the brick is marked as destroyed. The tool’s collision logic was correct on the first pass—it even proactively handled the rebound direction case by case (determining whether the ball hit from the side or from above/below), a level of detail that exceeded my expectations.

    Chinese Text Rendering: The Hardest Part of the Whole Task

    This is where the capability gap between tools shows most clearly. The firmware environment provides no font rendering service, so the only option is to build it yourself:

    1. Prepare a bitmap font: extract the 16×16 glyphs for the required Chinese characters—such as “打砖块游戏” (Breakout Game) and “得分” (Score)—from a 16×16 bitmap font file, and embed them directly in the source code as arrays to avoid runtime file loading.
    2. Implement glyph rendering: each character is 16×16 dots, one bit per dot. Iterate over the byte bits and draw a pixel wherever the bit is 1:
    1. void DrawChineseChar(int x, int y, const uint8_t *glyph, UINT32 color)
    2. {
    3. for (int row = 0; row < 16; row++) {
    4. for (int col = 0; col < 16; col++) {
    5. if (glyph[row * 2 + (col >> 3)] & (0x80 >> (col & 7)))
    6. DrawPixel(x + col, y + row, color);
    7. }
    8. }
    9. }

    Here the tool showed a clear knowledge gap: it could write the bitmap glyph rendering logic correctly, but its understanding of the byte order and layout of the glyph data needed human correction. Whether the font scans by row or by column, and whether the high bit or low bit comes first, varies between font formats. My glyphs were row-major with big-endian bit order, and the tool’s initial render function produced the classic symptom of Chinese characters appearing as vertical striped garbage. Once I described the symptom clearly, the tool quickly located the scanning-direction problem and provided a fix, with reasonable reasoning—but it lacked the ability to spot this pitfall proactively.

    Keyboard Input and a Non-Blocking Main Loop

    The game loop requires non-blocking key reads: keypresses move the paddle, and with no keypress the animation continues. The firmware provides a keystroke polling interface, and combined with a short delay it forms a stable loop:

    1. while (GameRunning) {
    2. EFI_INPUT_KEY Key;
    3. if (ReadKeyStroke(&Key) == EFI_SUCCESS) {
    4. if (Key.ScanCode == SCAN_LEFT) PaddleMoveLeft();
    5. if (Key.ScanCode == SCAN_RIGHT) PaddleMoveRight();
    6. if (Key.UnicodeChar == CHAR_ESC) GameRunning = FALSE;
    7. }
    8. UpdateBall();
    9. RenderFrame();
    10. DelayMillisecond(16); // roughly 60 FPS
    11. }

    The tool handled this logic quite maturely, covering details like movement pacing under key auto-repeat and state cleanup on ESC exit.

    Overall Assessment: A Capability Profile of AI Coding Tools

    I put this task to several mainstream AI coding tools, including terminal-based agent tools and IDE-embedded chat/completion tools. The overall experience boils down to a few points:

    1. Standard frameworks are nearly plug-and-play. For project skeletons, build configurations, and protocol calls—areas backed by mature documentation—the tools are consistently reliable, and the generated code often compiles as-is.

    2. Complex logic comes out well in one pass. For medium-complexity algorithm logic like the game loop, collision detection, and state machines, the tools produce well-structured implementations with fairly thorough edge-case handling.

    3. Long-tail knowledge is the clear weakness. For obscure topics like bitmap font layout and firmware-specific pitfalls (framebuffer alignment, the timing of locating file system protocols in Shell, etc.), the tools tend to produce code that “looks right but is actually wrong.” This is exactly where developer experience needs to provide the safety net.

    4. The debugging collaboration experience varies with interaction style. IDE-embedded tools win on context awareness, proposing changes based directly on the code in the editor. Terminal agent tools win on autonomous execution loops: they can compile, read errors, and iterate on their own, reducing back-and-forth—though they occasionally loop on the same fix and need a human to steer them back on course.

    Conclusion: For this kind of low-level systems development, AI coding tools can already handle roughly seventy percent of the coding workload, with especially clear productivity gains in scaffolding and logic implementation. But developers still need to retain an understanding of the underlying mechanisms. In non-standard environments like firmware or bare metal, details such as glyph layout and memory alignment still require human review. The tool is an amplifier, not a replacement—a statement that rings especially true in UEFI, a scenario where AI training data is thin.