From One-Sentence Game Generation to Reliable Delivery: Requirements, State, and Testing

    Natural-language game generation can quickly turn a short prompt into an interactive prototype, but a playable demo is not the same as reliable delivery. This article explains how to translate vague prompts into acceptance criteria, distinguish input gestures from game rules, model game flow with a state machine, externalize level and feedback configuration, control iterative changes, test rules and edge cases, and prepare generated mini-games for safe publication.

    1. Understanding the Real Value of Generative Development Through “One-Sentence Generation”

    Entering a prompt such as “make a small game” and receiving a page that users can click and interact with lowers the barrier to creating application prototypes. From a developer’s perspective, however, the more important question is not how fast generation happens. The real question is whether a natural-language requirement can be transformed into explicit, verifiable program behavior.

    A small game usually consists of five parts: the interface, rules, state, feedback, and runtime environment. Generating the interface is only the first step. Whether the buttons work, whether scores are calculated correctly, whether failure conditions make sense, and whether repeated operations corrupt state determine whether the game can actually be used.

    “One-sentence generation” is therefore better understood as the starting point of generative development, not the end point of reliable delivery. Its core workflow can be summarized as:

    Requirement description → Rule decomposition → Initial implementation → Runtime validation → Targeted revision → Release and delivery.

    In this workflow, natural language expresses the goal, the program executes the rules, and testing determines whether the two are consistent. Only when this loop is closed can rapid generation move beyond the “it looks playable” demo stage.

    2. First Distinguish Interactive Apps from Rule-Based Games

    Interactive fireworks and a match-three game can both be described in natural language, but they have different implementation-quality requirements.

    1. Interactive fireworks: focus on visual feedback and performance control

    Interactive fireworks usually do not have complex win/loss rules. The main flow is: the user clicks the screen, the system generates particles at the corresponding position, the particles move and change color over time, gradually disappear, and a short blessing is displayed.

    Key concerns for this type of application include:

    • Whether the click position matches the center of the fireworks;
    • Whether repeated clicks cause noticeable lag;
    • Whether particles are cleaned up after their lifecycle ends;
    • Whether sound effects play only after user interaction;
    • Whether animations and text cover the main interaction area;
    • Whether mute and reduced-motion options are available.

    “Romantic,” “dreamy,” and “richly layered” are design intentions, not directly executable rules. During development, they should be decomposed into specific behaviors such as color combinations, particle trajectories, opacity changes, and text display duration.

    For example, “every bloom brings a random surprise” can be implemented by selecting combinations from preset color palettes and trajectories, rather than calling a generative model again for every interaction. This helps control response latency and makes it easier to ensure that displayed content is safe and consistent.

    2. Match-three game: focus on rule consistency and stable state

    Beyond visuals and animations, a match-three game must handle swapping, matching, clearing, falling, refilling, cascades, scoring, and level resolution.

    The difficulty lies in the strict ordering of multiple steps. For example, after the player swaps two pieces, the program should first determine whether a valid match is produced and then decide whether to clear the pieces or restore their positions. If the player can continue interacting before the clearing animation ends, the visual positions and the logical board can become inconsistent.

    Complex games therefore cannot rely only on descriptions such as “make a fun game.” Rules should be defined first, and the generation process should be organized around those rules.

    3. Rewrite Vague Prompts as Acceptance-Ready Requirements

    An effective prompt is not necessarily longer; it is more explicit. A useful structure is to organize requirements around six dimensions: goal, rules, interaction, feedback, constraints, and acceptance.

    Below is an example requirement suitable for generating a match-three prototype:

    Create a match-three mini-game suitable for touchscreen operation. The board has seven rows and seven columns, and the pieces use five different generic animal icons. Players can only drag a piece to swap it with an adjacent piece above, below, left, or right. After a swap, a valid match occurs only when three or more identical pieces are aligned horizontally or vertically. If no match is produced, restore the original positions and do not deduct a move. After clearing, pieces above fall down and new pieces are refilled. Continue resolving cascades until the board is stable. The interface displays the current score, remaining moves, and level target. Temporarily disable new board operations during resolution. Provide a restart button, and ensure that the initial board has no automatic matches and has at least one valid move.

    The board size, piece types, and move-count rules here are example design choices, not defaults of any particular system. Their value is that they make the implementation result checkable.

    Compared with a generic description, this requirement clarifies several easy-to-miss boundaries:

    First, it limits swapping to adjacent directions, preventing diagonal or non-adjacent swaps.

    Second, it specifies whether invalid operations deduct a move, preventing inconsistent interaction rules.

    Third, it requires the initial board to be playable, preventing automatic clears immediately after entry or a board with no valid moves.

    Fourth, it writes input handling during resolution into the rules, reducing state errors caused by repeated touches.

    4. Clarify the Difference Between “Sliding” and “Swapping”

    In touchscreen games, “dragging,” “sliding,” and “swapping” are often used interchangeably, but they refer to different layers.

    Dragging is an input method: it refers to the movement of the player’s finger on the screen. Swapping is a rule behavior: it means two pieces exchange logical positions. A sliding animation is a visual representation: the pieces move along a trajectory rather than jumping instantly to the target position.

    Therefore, “change it to sliding, not swapping” is ambiguous. Developers need to confirm whether the user wants to modify the gesture, the animation, or the game rule.

    A more precise revision request can be written as:

    Keep the adjacent-piece swap rule, but change the operation from tapping two pieces to a drag gesture. The drag direction selects the adjacent target cell, and the swap uses a smooth displacement animation. If the swap does not produce a valid match, the two pieces return to their original positions with a rebound animation.

    This description preserves the match-three rule while improving the interaction experience. It also shows that the quality of natural-language revision depends heavily on whether input, logic, and presentation can be distinguished as three separate layers.

    5. Organize Core Game Logic with a State Machine

    To reduce the risks introduced by continuous operations and asynchronous animations, the game runtime can be modeled as a state machine.

    A simplified match-three flow includes:

    Waiting for input → Performing swap → Checking matches → Resolving clears → Falling and refilling → Checking cascades → Evaluating level → Waiting for input.

    The following pseudocode illustrates the control flow; function names are only illustrative:

    1. handle_player_move(start, end):
    2. if current_state != WAITING_FOR_INPUT:
    3. return
    4. if positions_are_not_adjacent(start, end):
    5. return
    6. current_state = SWAPPING
    7. swap_pieces_and_play_animation()
    8. matches = find_all_matches()
    9. if matches is empty:
    10. restore_swap_and_play_animation()
    11. current_state = WAITING_FOR_INPUT
    12. return
    13. remaining_moves -= 1
    14. while matches is not empty:
    15. current_state = RESOLVING
    16. score_after_deduplication()
    17. remove_matched_pieces()
    18. current_state = REFILLING
    19. compact_columns_and_fill_empty_slots()
    20. matches = find_all_matches()
    21. check_win_or_loss()
    22. if game_is_not_over:
    23. check_for_valid_moves()
    24. current_state = WAITING_FOR_INPUT

    There are three implementation points here.

    First, match detection should cover both horizontal and vertical directions. A single piece may belong to two match sequences at the same time. It must be deduplicated before scoring; otherwise, intersecting matches can easily be counted more than once.

    Second, after falling and refilling are complete, matches must be detected again rather than cleared only once. The cascade process should continue until the board is stable.

    Third, a stable board may still have no valid moves. The system should reshuffle or end the game according to predefined rules instead of leaving the player in an unusable state.

    If asynchronous animations are used, the implementation should also consider how to cancel old tasks when the player restarts the game, preventing callbacks from the previous round from modifying the new board.

    6. Design Levels and Feedback as Independent Configuration

    Levels should not be scattered across interface code and decision logic. A more robust approach is to manage target scores, move limits, and feedback copy in a centralized place.

    For example:

    1. level_config:
    2. level_1:
    3. target_score = 600
    4. max_moves = 18
    5. level_2:
    6. target_score = 1000
    7. max_moves = 20

    The values above only demonstrate the configuration structure. Actual difficulty needs to be adjusted through playtesting. A higher target does not necessarily mean a better experience; board size, icon types, cascade probability, and scoring method all affect level difficulty.

    Feedback copy should also be separated from rules. When a level is completed, the game can display “Nicely done.” When it fails, it can prompt “Try again, and first look for positions that can form cascades.” Do not assume the player’s gender or age by default, and avoid failure feedback that is humiliating.

    Level resolution also needs a clear priority. If the player reaches the target on the last move, the game should first determine a win and then determine that moves are exhausted. Otherwise, a score that has already met the target may still be shown as a failure.

    7. Natural-Language Iteration Also Needs Change Control

    Adding requirements continuously is convenient, but each generated revision may affect existing logic. Asking only to “add levels” without emphasizing that swapping, scoring, and cascade rules must be preserved may produce a new version that fixes the interface but changes the gameplay.

    Each iteration should follow three principles:

    Handle one major issue at a time. Fixing the drag gesture first, then adding levels, and finally polishing sound effects makes errors easier to locate than changing multiple modules at once.

    State explicitly which behaviors must not change. For example: “Only replace the piece icons; do not modify the board size, matching rules, or scoring logic.”

    Attach acceptance conditions to each revision. For example: “After an invalid swap, the score and moves remain unchanged; after restart, old animations no longer update the board.”

    For applications that need long-term maintenance, keep rollback-capable versions and a short change log. Natural language is not a replacement for version management; it is one way to request changes.

    8. Testing Cannot Stop at “It Opens and Plays”

    Mini-game testing should cover at least four categories: rules, interaction, performance, and exception handling.

    1. Rule testing

    Check whether three-piece matches, four-piece matches, intersecting matches, and cascades are handled correctly; verify whether invalid swaps are restored; confirm that the initial board has no matches and contains valid moves; and validate edge cases such as winning on the last move and having no valid moves.

    Randomly generated boards increase reproduction difficulty. The test environment can use fixed boards or repeatable random sequences to ensure that the same defect can be reproduced consistently.

    2. Interaction testing

    Rapid consecutive drags, dragging outside the board, dragging diagonally, and tapping restart during an animation can all expose input-handling problems.

    During testing, observe both the final board and whether the score, remaining moves, and internal state remain consistent. A normal-looking screen does not mean the logic is correct.

    3. Performance testing

    Fireworks particles, complex clearing animations, and overlapping sound effects can all increase resource consumption. Limit the number of simultaneous particles, clean up invalid objects promptly, and reduce effect complexity according to device performance.

    Do not treat a single generation time or a playtest result on one device as a general performance conclusion. Generation latency and runtime behavior are affected by requirement complexity, network conditions, resource loading, device capability, and other factors.

    4. Exception testing

    Also consider resource loading failures, the page entering the background, screen-size changes, and unavailable storage. For offline mini-games, the core gameplay should depend as little as possible on continuous network connectivity. When non-essential resources fail to load, provide a reasonable fallback rather than blocking the entire game session.

    9. Move from Personal Playtesting to Safe Publication

    If a generated mini-game is to be shared through a link, it needs to move beyond “the code runs” toward “runtime boundaries are controllable.”

    Generated code should execute in a restricted environment and avoid obtaining unnecessary device permissions. Before publication, check external requests, dynamic code execution, and storage of sensitive information. Do not assume that model output has already passed a security review.

    For offline mini-games, it is usually sufficient to save a small amount of local progress. Do not collect personal information unrelated to gameplay. If accounts, leaderboards, or multiplayer collaboration are added, additional consideration is needed for authentication, access control, and server-side validation. Scores submitted by the client cannot be treated as trusted results.

    Assets such as images, fonts, and audio also require clear licensing scope. A generated page does not mean the assets can be used commercially without restriction. When the source cannot be confirmed, prefer self-made resources or assets with clear authorization.

    Necessary accessibility support should also be provided, such as not using color as the only means of identification, adding shape differences to icons, providing a mute switch, and allowing users to reduce flicker and motion effects.

    10. Conclusion: Let Generation Speed Serve Engineering Quality

    The main value of natural-language mini-game generation is that it compresses the distance from a requirement to an interactive prototype, allowing ideas to enter validation faster. But the closer a game gets to real publication, the more it needs explicit rules, state control, test validation, and security constraints.

    In practice, start with an application with fewer states, such as interactive fireworks, to validate the generation pipeline. Then move on to games with more complex rules, such as match-three. Each iteration should focus on a clear problem and confirm the result with reproducible tests.

    One sentence can start development, but reliable delivery requires a complete engineering approach. Combining generation capabilities with requirement modeling, state machines, configuration management, regression testing, and security review is what allows a mini-game to grow from a one-off demo into a genuinely usable and maintainable small application.