Evaluating AI Coding Capabilities: From a Minesweeper Prototype to Engineering Delivery

    This article explores how to objectively evaluate the engineering delivery capabilities of AI-assisted programming. Using the generation of a Minesweeper application as an example, it emphasizes that merely generating code or a running application does not equate to engineering delivery. The article details acceptance criteria, state model design, core algorithm verification, and test coverage. It points out that the true value of AI coding lies in rapidly converting natural language requirements into testable prototypes, while developers must shift their focus toward rule design, quality assurance, and risk control to form a complete engineering closed-loop.

    I. Rethinking AI Programming: Generating a Complete App Does Not Equal Engineering Delivery

    In the past, developers’ expectations for AI programming primarily focused on localized tasks: completing a function, explaining a code snippet, locating a bug, or generating repetitive business logic. Today, a more pressing question arises: when given only a single prompt like “Create a complete Minesweeper app,” can AI programming organize requirement understanding, UI construction, rule implementation, and interaction handling into a relatively complete program?

    Such tasks do intuitively demonstrate code generation capabilities. Minesweeper is easy to understand, the results are directly observable, and it involves typical programming challenges like random layout, adjacency calculation, recursive or iterative expansion, and state transitions. It is closer to actual app development than a single function, yet easier to establish clear validation criteria for than complex business systems.

    However, three concepts must be distinguished:

    First, generating code means the system has completed a text-level program expression.

    Second, a program that can run demonstrates executability under the current environment and certain operational paths.

    Third, a program that is deliverable means it meets agreed requirements, passes necessary tests, and maintains testability, compatibility, and clear usage boundaries.

    There is a clear gap between these three. Long code length, a smooth output process, or a seemingly complete UI cannot independently prove program correctness. Evaluating AI programming should shift from “the output is amazing” to “the result is verifiable.”

    II. Why Minesweeper is a Good Sample for Observing App Generation Capabilities

    Although small in scale, Minesweeper covers various common engineering capabilities.

    At the data layer, it needs to maintain the board, mine positions, adjacent mine counts, and cell display states. At the logic layer, it handles the first click, blank area expansion, flagging, win/loss determination, and restart. At the interaction layer, it differentiates input methods and ensures no invalid operations are accepted after the game ends.

    These segments are not independent. For instance, when the timer starts depends on how the game state is defined; whether the first click is safe affects when mines are generated; whether flags are limited by quantity affects the count display and interaction feedback.

    Therefore, a seemingly simple app can actually test the following capabilities:

    • Identifying implicit rules behind a brief requirement.
    • Translating rules into a consistent data model.
    • Handling edge cases outside normal workflows.
    • Keeping the UI display synchronized with the internal state.
    • Generating testable and modifiable implementations rather than one-time demo code.

    At the same time, its limitations must be acknowledged. Minesweeper typically does not involve authentication, complex permissions, data persistence, cross-service transactions, or high-concurrency processing. Therefore, the completion of a small game cannot be used to infer an AI’s ability to autonomously deliver complex business systems.

    III. Define Acceptance Criteria Before Evaluating Generation Results

    Natural language requirements can be short, but acceptance criteria cannot be ambiguous. A “complete Minesweeper” might include different rules for different people.

    For example: Is the first click allowed to hit a mine? Does it support clicking adjacent cells around an already revealed number simultaneously? Can the number of flags exceed the total number of mines? Are all mines displayed after hitting one? How is flagging handled on mobile devices?

    These are not implementation details but requirements that directly affect program behavior.

    A basic version can explicitly define the following acceptance scope:

    Feature Category Acceptance Requirements
    Board Initialization Rows, columns, and mine count are valid; cell count is correct.
    Mine Layout Positions do not repeat; actual mine count matches configuration.
    Number Calculation The number for each non-mine cell equals the count of mines in the eight adjacent directions.
    Reveal Operation Revealed cells are not processed repeatedly; flagged cells are not revealed by normal clicks.
    Blank Expansion Automatically expands connected blank areas and their boundary numbers; does not expand mines.
    Flagging Operation Flag state is consistent with the count display; rules are clear.
    Win/Loss Determination Wins when all non-mine cells are revealed; loses when a mine is clicked.
    Timer & Reset Starts, stops, and resets as agreed; no leftover tasks from previous rounds.

    If a safe first click is required, the safe range needs further definition. Ensuring only that the first clicked cell is not a mine is different from ensuring its surrounding ring is also mine-free. The latter imposes stricter capacity constraints on high-density boards and cannot be unconditionally satisfied under any configuration.

    A more effective requirement expression could be:

    “Generate a Minesweeper app that runs in a browser, including difficulty selection, flagging, timing, and reset. The first revealed cell must not be a mine, and revealing all non-mine cells determines a win. Please separate the rule logic from UI events and provide boundary test explanations.”

    Such a description does not artificially increase the burden but reduces the deviation between the generated result and actual expectations.

    IV. Use Clear State Models to Constrain Program Behavior

    A common issue with AI-generated code is not missing buttons, but the lack of unified state design. Multiple event handlers modifying variables separately can easily lead to inconsistencies like “the UI shows the game has ended, but the timer is still running internally.”

    It is recommended to distinguish at least two levels of state.

    1. Game-Level State

    The game can be divided into four states:

    • Idle: The board is ready, but no valid reveal has occurred yet.
    • Playing: Reveals, flagging, and timing are allowed.
    • Won: Timer stopped; further board changes are disabled.
    • Lost: Timer stopped; failure result is displayed.

    State transitions should be constrained. For example, a Lost state cannot return to Playing via a normal click; only a reset operation can initiate a new round.

    2. Cell-Level State

    Each cell can include:

    • Whether it is a mine.
    • The number of adjacent mines.
    • Whether it is revealed.
    • Whether it is flagged.

    Invariants must be maintained among these fields:

    • The same cell cannot be both revealed and flagged simultaneously.
    • The adjacent mine count of a non-mine cell must be between zero and eight.
    • The total number of mines on the board must match the configuration.
    • The number of revealed non-mine cells cannot exceed the total number of non-mine cells.

    Invariants are more valuable than UI screenshots. Screenshots only show a specific moment, whereas invariants can verify whether the rules are followed throughout the entire operational process.

    V. Core Algorithms Should Be Independently Explainable and Verifiable

    1. Mine Generation: Focus on Deduplication and First-Click Rules

    Randomly generating mines should not rely solely on repeatedly picking coordinates while ignoring duplicates. A clearer approach is to construct a set of valid candidate cells and select a specified number of positions without replacement.

    If a safe first click is required, mines can be generated upon the first valid reveal, excluding that cell from the candidate set. If the surrounding area must also be safe, adjacent cells must be excluded simultaneously, and a check must be performed before generation to ensure enough positions remain.

    This design implements “safety guarantees” as explicit constraints rather than temporarily moving mines after a hit. The latter is not necessarily infeasible, but it increases the complexity of number recalculation and state consistency handling.

    2. Adjacent Numbers: Unified Boundary Handling

    For each non-mine cell, check the eight surrounding directions and count the mines within valid coordinates.

    The key is to unify the coordinate validity check to prevent out-of-bounds access at the top, bottom, and corners. Do not let different functions implement their own boundary rules, otherwise behavioral differences are likely to occur when modifying the board size later.

    3. Blank Expansion: Use Queues to Control Traversal

    When a cell with zero adjacent mines is clicked, it is necessary to expand the connected blank area and reveal the numbered cells on the boundary of that area.

    For larger boards, iterative traversal using a queue is generally easier to control than deep recursion. Below is the conceptual pseudocode:

    1. Add the starting cell to the queue
    2. Mark the starting cell as enqueued
    3. While the queue is not empty:
    4. Dequeue a cell
    5. If the cell is already revealed, flagged, or a mine:
    6. Skip
    7. Reveal the cell
    8. If the cell's adjacent mine count is zero:
    9. Iterate through all valid adjacent cells
    10. Enqueue non-mine cells that are not enqueued, not revealed, and not flagged

    Marking cells as enqueued prevents the same cell from being added multiple times, especially in large blank areas. The key here is not whether the code is short, but whether it can explain why it won’t go out of bounds, why it won’t expand mines, and why it won’t loop infinitely.

    4. Win Condition: Based on Revealed Safe Cells

    Under basic rules, the win condition can be expressed as:

    “The number of revealed non-mine cells equals the total number of cells minus the number of mines.”

    Do not simply use “the number of flags equals the number of mines” as the win condition, because flags might be placed incorrectly. Even if choosing to use correctly flagging all mines as an alternative rule, the flag positions must be explicitly verified, not just the count.

    VI. Tests Should Cover Rules, Not Just Confirm the Page Loads

    The fact that a program can display a board only proves the most basic execution path works. Effective testing should include three categories.

    1. Deterministic Rule Testing

    Use fixed mine layouts to verify adjacent numbers, blank expansion, and win/loss determination. Random boards are suitable for actual play but are not suitable as direct inputs for all tests, as failures may be hard to reproduce.

    Mine layout generation can be separated from board rule calculation, allowing tests to inject fixed layouts. This is also part of maintainable design.

    2. Boundary and Exception Testing

    Focus on checking:

    • Single-row, single-column, and very small boards.
    • Zero mines or a mine count near the allowed maximum.
    • Clicking the four corners and four edges.
    • Repeatedly clicking already revealed cells.
    • Consecutive flagging and unflagging.
    • Continued clicking after the game ends.
    • Repeatedly resetting during timing.
    • Inputting invalid row/column numbers or mine counts.

    If the program supports delayed mine generation, also test whether “flagging before the first click” affects layout rules and counts.

    3. Interaction Consistency Testing

    Auxiliary click methods in desktop environments may not apply to touch devices. You can provide a clear toggle for flagging mode or use explained touch interactions, but false touches must be avoided.

    Additionally, numbers should not rely solely on color for differentiation; buttons and status prompts should have clear text; keyboard accessibility should also be considered based on the target audience. Visual completeness does not mean all users can operate it smoothly.

    VII. How to Objectively Evaluate AI Programming Results

    When evaluating, output speed and lines of code should not be the top priorities. More reasonable observation dimensions include:

    Functional Coverage: Are all agreed requirements fully implemented, without replacing complex parts with static displays or placeholder logic?

    Rule Correctness: Under fixed tests and boundary conditions, does the program consistently satisfy invariants?

    Execution Reproducibility: Are operating conditions explained? Are dependencies clear? Can it be started according to instructions in a clean environment?

    Modification Cost: When adjusting board size, adding interaction methods, or changing win rules, does it require extensive rewrites?

    Explanation and Fix Quality: After discovering a problem, can the root cause be located and a scoped fix provided, rather than repeatedly overwriting the entire project?

    Human Intervention Level: How much effort did the developer invest in requirement clarification, debugging, and review, and which part of the cost was ultimately saved?

    To form a more reliable conclusion, multiple attempts should be made under the same requirements, acceptance criteria, and operating conditions, recording defects and the fixing process. A single success can prove a task was completed, but it is insufficient to prove stability, let alone replace the evaluation of complex engineering tasks.

    VIII. From a Runnable Prototype to a Maintainable Project

    For a local single-player mini-game, the delivery focus is usually code organization, test coverage, interaction experience, and operating instructions. There is no need to introduce backends or cloud resources just to appear complete.

    Only when adding features like accounts, leaderboards, or score synchronization is it necessary to reconsider server storage, permission verification, request rate limiting, and data reliability. For leaderboards in particular, scores submitted by the client cannot be directly trusted, otherwise users can forge scores by modifying request payloads.

    Similarly, external dependencies in generated code should be reviewed. Functions that can be accomplished with basic capabilities do not need arbitrary dependencies; when dependencies are genuinely needed, their usage, licensing, version constraints, and potential risks should be checked. AI generation does not absolve these engineering responsibilities.

    A relatively stable collaboration workflow is:

    1. Developers define the feature scope, rules, and acceptance criteria.
    2. AI programming generates a minimum runnable version and explains design assumptions.
    3. Run automated tests and manual interaction checks.
    4. Fix defects item by item to avoid aimless rewrites.
    5. Organize code structure, running instructions, and known limitations.
    6. Deliver within clearly defined usage scenarios.

    IX. Conclusion: The Closed-Loop Capability is What Truly Matters

    Taking Minesweeper as an example, the value of AI programming lies in rapidly translating a set of natural language rules into an observable, testable application prototype. It can reduce repetitive coding, allowing developers to enter the validation and iteration phases earlier.

    However, “generating complete code” and “reliably completing a project” remain different propositions. The former focuses on output, while the latter requires a closed loop of requirements, implementation, testing, and maintenance.

    Therefore, when judging how well AI programming performs, the most valuable questions are not “how many lines it wrote,” but “which requirements were correctly implemented, which boundaries were verified, and whether problems can be fixed at a low cost.” Developers’ responsibilities will not disappear; instead, they will shift more toward rule design, quality assurance, and risk control. Only by integrating these tasks with code generation can AI programming transform from an impressive demo into a stable, reusable engineering productivity tool.