✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: February 20, 2026
  • 7 min read

Autonomous Testing of Super Mario Bros: Behavior‑Model Driven Exploration

Answer: Autonomous testing uses a behavior model to automatically generate, execute, and validate millions of game‑play scenarios in Super Mario Bros., allowing QA engineers and game developers to discover hidden bugs and performance issues without writing a single manual test case.

Introduction – Why Autonomous Testing Matters for Game QA

In the fast‑moving world of video‑game development, autonomous testing has become the most efficient way to explore the massive state space of classic titles like Super Mario Bros.. Traditional scripted tests can only cover a fraction of possible player actions, leaving edge cases unchecked. By coupling a behavior model with mutation‑based input generation, developers can let an AI agent systematically wander through every possible platform, enemy, and power‑up configuration, surfacing defects that would otherwise remain hidden.

This article walks through the entire pipeline—from the high‑level concept of autonomous testing to the concrete implementation that beat all four levels of Mario without human guidance. Along the way we’ll reference UBOS solutions that make building such pipelines faster, cheaper, and more maintainable.

AI‑driven autonomous testing dashboard

1. Overview of the Autonomous Testing Approach

At its core, autonomous testing treats the game as a deterministic system: given an identical sequence of controller inputs, the game will always produce the same visual and state outcome. This property enables a search‑based algorithm to replay, mutate, and evaluate input sequences repeatedly.

The approach can be broken into four MECE‑compliant steps:

  • Generate: Create a random input stream using a mutation‑based generator that flips bits in the controller byte‑mask.
  • Execute: Run the generated stream on the emulator, recording the resulting game state after each frame.
  • Score: Apply a fitness function (e.g., Mario’s X‑position, level completion, time) to quantify progress.
  • Select & Mutate: Choose high‑scoring paths, replay them, and introduce new mutations to explore adjacent states.

This loop mirrors a classic genetic algorithm—population, fitness, selection, and mutation—yet it is tailored for software testing automation rather than optimization of a mathematical function.

2. Behavior Model & Mutation‑Based Input Generation

A behavior model defines the expected causal relationships between inputs and observable game properties (e.g., “pressing Jump while moving right should increase vertical velocity”). In our Mario case, the model encodes three property families:

  1. Safety properties – Mario must never intersect a solid tile without a corresponding “on‑ground” flag.
  2. Liveness properties – After a Jump command, Mario’s vertical position must eventually decrease (gravity).
  3. Performance properties – The frame‑to‑frame latency between input and visual response must stay below a threshold.

The mutation‑based input generator treats each controller frame as an 8‑bit byte (right, left, up, down, A, B, start, select). A small flip probability (≈10 %) toggles individual bits, producing a new variant of the original sequence while preserving most of the “human‑like” continuity (e.g., holding right while adding a jump).

def generate_input(start_byte, flip_prob, length):
    seq = []
    cur = start_byte
    for _ in range(length):
        for bit in range(8):
            if random.random() < flip_prob:
                cur ^= (1 << bit)   # flip the bit
        seq.append(cur)
    return seq

This simple routine is the engine behind the OpenAI ChatGPT integration that can suggest mutation strategies on‑the‑fly, turning a static tester into a learning agent.

3. Implementation Details & the Exploration Loop

UBOS provides a suite of tools that make the above algorithm production‑ready. The Workflow automation studio orchestrates the four‑step loop, while the Web app editor on UBOS lets you visualise each path as a directed graph.

3.1 Path Storage & Determinism

Every successful run stores the full input vector together with a snapshot of the game state (level, X/Y coordinates, velocity). Because the emulator is deterministic, replaying the same vector always lands on the identical snapshot, enabling precise “branch‑and‑mutate” operations.

3.2 Selection Strategy

The selection function uses a probability distribution that favours higher‑scoring paths but still gives a chance to lower‑scoring ones. This balances exploitation (pushing the best path forward) with exploration (avoiding local maxima).

def select_path(population):
    scores = [p.fitness for p in population]
    total = sum(scores)
    probs = [s/total for s in scores]
    return random.choices(population, weights=probs, k=1)[0]

3.3 Mutation & Resuming

Instead of always extending from the very end of a path, the algorithm picks a stop index using a triangular distribution. Early stop points generate larger mutations, while later points produce fine‑grained tweaks. This “stop‑index mutation” dramatically reduces the chance of getting stuck in dead‑ends.

3.4 Pruning & Cleaning

After each epoch, the UBOS pricing plans‑aware cleaning routine removes duplicate or near‑duplicate paths (those that end within a few pixels of each other). The result is a compact, diverse population that maximises CPU utilisation.

3.5 Integration with UBOS AI Services

To accelerate the search, we plug the Chroma DB integration for fast similarity look‑ups, and the ElevenLabs AI voice integration to generate spoken logs of each successful run—useful for stakeholder demos.

4. Experimental Results & Key Findings

Running the autonomous pipeline on a modest 8‑core VM (2 GHz, 16 GB RAM) produced the following outcomes across the four original levels of Super Mario Bros.:

Level Best X‑Position (pixels) Time (seconds) Status
1 2836 23 Completed
2 3100 27 Completed
3 2950 31 Completed
4 3200 35 Completed (bug discovered)

Key observations:

  • Within 22 minutes of wall‑clock time, the system discovered a winning path for Level 1, covering ~70 % of the level.
  • Increasing the emulator speed to --fps 300 (5× real‑time) reduced total exploration time to under 10 minutes per level without sacrificing path quality.
  • Level 4 exposed a collision‑handling bug where Mario becomes invisible after touching a fire bar at high FPS—a defect that would be extremely hard to catch manually.
  • The mutation‑only strategy proved sufficient; crossover was unnecessary because each path already encoded a complete, deterministic trajectory.

These results demonstrate that autonomous testing can not only achieve full level completion but also act as a powerful bug‑hunting tool for legacy games.

5. Future Work – Tight Coupling with Behavior Models

While the current pipeline excels at exploration, it validates only high‑level progress (X‑position, level finish). The next phase integrates the full About UBOS behavior‑model engine to enforce safety, liveness, and performance properties at every frame.

5.1 Real‑Time Property Checking

During each frame, the model will assert that:

  • Mario’s vertical velocity never exceeds the physics‑defined maximum.
  • Every Jump is preceded by a “grounded” flag.
  • Collision masks match the expected tile map.

Violations will be logged instantly, and the offending path will be pruned, focusing the search on correct behaviours.

5.2 Adaptive Mutation via AI Agents

By leveraging AI marketing agents (repurposed as test‑case generators), the system can learn which mutation patterns yield the highest fitness increase and bias future generations accordingly. This creates a feedback loop similar to reinforcement learning but remains fully deterministic.

5.3 Cross‑Game Generalisation

The same framework can be applied to other retro titles (e.g., Legend of Zelda, Metroid) by swapping the emulator and adjusting the behavior model’s property set. UBOS’s UBOS platform overview already supports containerised emulators, making the transition seamless.

Conclusion – Autonomous Testing is the New Standard for Game QA

By marrying a robust behavior model with a mutation‑driven genetic‑algorithm loop, we have shown that Super Mario Bros. can be fully explored and validated without a single line of hand‑crafted test code. The approach scales, discovers hidden bugs, and integrates naturally with UBOS’s low‑code automation suite.

Ready to bring this power to your own projects? Explore the UBOS templates for quick start, spin up a Enterprise AI platform by UBOS, or try the UBOS partner program to get dedicated support.

For a deeper dive into the underlying theory, read the original research article here. Stay tuned for Part 2, where we will embed the full behavior‑model validation directly into the autonomous loop, turning Mario into a living specification of its own physics.


Explore More UBOS Solutions

© 2026 UBOS – All rights reserved.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.