Eight Pokémon Red badges with Laya + Qwen running locally

CPU-based Laya on a NUC 15 Pro, with local Qwen on a ROG, helped take Pokémon Red from the opening to all eight gym badges. Gameplay clips show the tools, wrong menu choices, navigation problems and losses along the way.

Why try Laya with Pokémon?

I saw people sharing what Laya could do as a decision model. It looked cool, so I wanted to try it in a game. If it could choose among several options, could it choose which button to press next in Pokémon?

Pokémon involves walking, dialogue, battles and story events that need to happen in sequence. It gave me a way to see what the model chose in different situations, and to investigate what went wrong when it got stuck.

I had also been following decision models such as JEV. This experiment uses open-source Laya without calling the JEV API. A separate local reasoning model handles higher-level game planning.

CPU-based Laya runs on my NUC 15 Pro

I was surprised that the NUC 15 Pro could run Laya on its CPU for button selection. My unit is the NUC15CRHC5, and I did not add a discrete GPU for Laya.

The larger Qwen reasoning model runs on a separate ROG NUC 16 Edition 20 with a GeForce RTX 5090 Laptop GPU. The NUC 15 Pro runs the game, controller and Laya; the ROG provides the Strata model service.

  • CPU: Intel Core 5 210H, 8 cores / 12 threads.
  • GPU: integrated Intel Graphics; Laya inference uses the CPU in this experiment.
  • DRAM: 32 GB installed.
  • ROG model ID: qwen3.8-flash-next-iq3_s.

The tools and how they work together

PyBoy runs the game. A Python controller reads the location, party, health and dialogue, then prepares the current task and allowed inputs. Laya classifies these options on the NUC 15 Pro CPU and PyBoy executes the result. Identical inputs can reuse a cached classification.

Qwen on the ROG is served through Strata. At startup and selected resumes, it chooses among implemented game stages. Some later runs reuse an approved stage rather than asking Qwen again at every step. Python code provides the campaign, routes, menus and tactical subgoals; Laya then selects button inputs.

For debugging, I used Codex to inspect logs and Python code, with Computer Use to check the game window and see where the character was stuck. PyBoy retains logs, screenshots, recordings and saves during play so I can compare what happened before and after a failure. Computer Use supports debugging and visual checks; Laya and PyBoy still handle button selection and execution in the gameplay loop.

When the character stopped at a door, I had to work out whether the next input was wrong, an obstacle was in the way, or the transition had not finished. Another time, the system interpreted an NPC's “Wait!” as an instruction to wait. Comparing the screen with the logs helped locate the part that needed fixing.

Python controller, CPU-based Laya and PyBoy form a gameplay loop on the NUC 15 Pro. Qwen via Strata on the ROG selects stages. Codex and Computer Use support development outside that loop.
System diagram made with GPT Image using official ASUS product photos as references. Dashed arrows indicate stage selection or engineering support. The local gameplay loop runs on the NUC 15 Pro. Open the image to zoom.
  • PyBoy: runs Pokémon Red, receives inputs and saves game frames and progress.
  • Laya: classifies a bounded set of button options on the local CPU.
  • Qwen + Strata: selects implemented stages at startup or selected resumes; later runs can reuse an approved stage.
  • Codex + Computer Use: development, log inspection, code fixes and window checks, outside the per-button gameplay loop.
Hardware and version details

The NUC 15 Pro runs Windows and Python 3.11. The setup record lists Laya 0.4.13, PyBoy 2.8.1 and the English convaiinnovations/laya checkpoint. The ROG and NUC communicate over a private network; endpoints and credentials are not included.

The first-gym record contains three Computer Use window-verification calls and zero Computer Use gameplay-input calls. Codex supports development; game classification runs locally. Their model usage is recorded separately.

Records for gyms two through four include actual Strata stage requests. Later resumes also explicitly record new_api_call=false. Local AI here describes gameplay inference; development and debugging still use Codex.

Naming, a lost first battle and the first badge

I picked five clips from the run. The early ones cover naming, walking and dialogue; training and gym battles come later. I kept the first loss so the sequence shows how the experiment progressed.

These are silent, game-only recordings with model waits omitted. Playback length is not the elapsed experiment time. Each clip has its own description.

Naming the player KEVIN

The first task was entering a name. Moving around the letter grid, selecting letters and confirming the result took several rounds of checking the screen and adjusting the controls. This clip shows the completed naming sequence.

00:21 | Game capture; model waits omitted.

Leaving home and getting Bulbasaur

Next came the stairs, the front door, Professor Oak and the lab. A plant and a doorway had blocked earlier attempts. After fixing the route and transition handling, the player received Bulbasaur.

01:30 | Opening sequence through receiving the starter; model waits omitted.

Losing the first rival battle

The rival battle came soon after choosing the starter. Bulbasaur lost. I kept the loss and continued from the game's post-battle state. The clip includes the moment Bulbasaur faints.

01:50 | The actual first rival-battle loss; model waits omitted.

Training in the wild and collecting the parcel

Wild battles brought enough experience for Bulbasaur to reach level 6. The player also collected Oak's parcel at the shop. Health, healing and dialogue all needed handling before the story could continue.

01:30 | Level 6 and parcel collection; model waits omitted.

The first gym: Brock

By the first gym, Bulbasaur could use Vine Whip. This clip joins the gym battles and reward sequence through receiving the Boulder Badge. I also reloaded the save to confirm the badge and Brock's defeat had been saved.

04:09 | Gym segments joined chronologically; model waits and repeated stalled dialogue omitted. Playback length is not elapsed play time.
First-gym results and timing notes

After the first gym, I checked the Brock event, Boulder Badge value and reloaded save. The party was a level-15 Bulbasaur, level-3 Nidoran and level-3 Spearow. The action and timing figures below cover only that first-gym record, not all eight gyms.

The run contains 33 chained segments and 4,111 button actions: 570 uncached Laya choices and 3,541 classification-cache hits.

For the 201 uncached classifications in segment group d, the median was about 1.38 seconds and the 95th percentile about 2.46 seconds. These figures belong to this CPU and controller version. CPU/GPU and rules-only comparisons have not been run. The gym video lasts about 248.5 seconds and also removes repeated stalled dialogue.

Game imagery belongs to its respective rights holders. These are experiment recordings; no ROMs or saves are offered for download.

Gyms two to four: menus, switches and supplies

Before Misty, the controller made a mistake in the move-learning menu. It was supposed to skip PoisonPowder, but lost track of the question after a text-page change and confirmed the deletion of Tackle. I kept the result and changed the code to remember whether it was answering the delete-move or stop-learning prompt. Vine Whip remained available, and the team went on to beat Misty.

The trash-can switches in Vermilion Gym took 71 checks and five resets. Finding the switch was only part of it: the dialogue needed to finish and the door actually had to open before walking through. A changed event value alone was not enough.

In Rock Tunnel, Vine Whip ran out of PP and the party was low on health, but the system kept going. The whole party fainted. I continued through the normal blackout and return to town, kept the loss, and added health and supply checks before walking. On the next attempt, the controller stopped when Fearow had 39/70 HP, returned to the entrance for healing, then continued through the tunnel and beat Erika.

Misty: continuing with the changed move set

The second-gym battle and victory are shown here. I did not reload to undo the deletion of Tackle; the party continued with its actual moves.

00:39 | Edited to 4× speed; inference and engineering waits omitted. Not elapsed play time.

Trash-can switches: trying again after a reset

A selected reset and the final successful opening are included. The video does not show all 71 checks.

00:10 | Selected segments at 4×; inference and engineering waits omitted.

Rock Tunnel: running out of moves and fainting

The clip preserves exhausted PP, low health and the blackout recovery. This loss prompted the later supply checks.

00:39 | Selected segments at 4× with a three-second final freeze; inference and engineering waits omitted.

Gyms five to eight: what the wins cost

Koga’s final Weezing used Self-Destruct and Nidoking fainted too, but the game awarded the win. Against Sabrina, Snorlax still had 111/198 HP but was poisoned. A simple half-health threshold missed the risk: a critical hit knocked it out, and Fearow finished the battle. These fights sent me back to the switching and health checks; one threshold could not cover every situation.

The Blaine battle consumed ten Hyper Potions. The code also encountered health values updating before the visible bar and a completion message without the expected arrow. I used Codex to compare logs with the screen, fixed the handling and continued the same battle. Even when Arcanine had only 4 HP left, the controller initially prioritized healing. After adjusting the finishing decision, Lapras used Surf to end it.

Giovanni was the eighth gym. Lapras went from level 39 to 41, with no healing items used and no new party fainting in that battle. On the evening of October 25, 2026, the badge value changed from 127 to 255: all eight gyms were complete.

Koga: both faint, but the game awards the win

The clip starts with the final Weezing and includes Self-Destruct, Nidoking fainting and the badge reward.

00:15 | Final opponent and reward at 4×; inference and engineering waits omitted.

Blaine: finally finishing after ten potions

This is the final Arcanine defeat and reward. The ten potion uses and debugging work are not shown in this short clip.

00:15 | Final battle sequence and reward at 4×; inference and engineering waits omitted.

Giovanni: earning badge number eight

The gym-leader battle and reward are retained. Eight badges are now complete; the Elite Four and Champion come next.

01:06 | Full gym-leader battle and reward at 4×; inference and engineering waits omitted.
Eight-gym completion record

October 23, 2026: Brock, Misty, Lt. Surge and Erika. October 24: Koga and Sabrina. October 25: Blaine and Giovanni. Events, badges and rewards were checked for each gym. The eighth badge was recorded at 20:24:35 Taipei time on October 25.

The eighth-gym record contains 139 actions, no healing-item use and no new fainting. Those are results for that battle, not a claim of a loss-free run or achievement by the model alone.

The Sabrina review still contains proposed improvements to switching strategy. This article does not present those suggestions as validated fixes. The Elite Four, Champion and Hall of Fame are outside this eight-gym milestone.

Next: stock-screening logic and a model selector

After trying Pokémon, I want to use Laya in other settings. One is stock-screening logic: I would define the conditions and prepare the data, then have the model classify candidates and compare its selections with my existing rules. I plan to start with historical data, without connecting it to automatic trading.

The other idea is a cloud/local model selector. It would classify an incoming question, decide whether local or cloud processing fits, and route it to the corresponding service. I want to start with questions I ask in daily work, comparing answer quality, waiting time and token usage.

Try it yourself — the project is on GitHub

I have put the code and setup instructions on GitHub. You can run the opening on your own computer, keep the recordings and saves, and resume from your last session.

Laya runs on a CPU, so you do not need my RTX 5090 or Qwen 3.8 model. The setup tool checks available memory and suggests a smaller local model. You can also configure your own cloud API. To try Laya without a second model, choose the fixed-stage controller.

Bring your own authorized English Red ROM matching the revision in the guide, and your own API key if you choose cloud processing. The beginner entry point covers the opening and first-gym workflow and saves before stopping on unsupported situations. My eight-badge run included several days of debugging and review; a fresh download does not guarantee the same result.

← Back to all notes