Inspect → rebuild → change

Rebuild the dinosaur’s speed rule.

To recreate the game’s acceleration, first find the rule that controls its speed. REA returned the running script; we used its rule to build this mini-game with adjustable speed.

Play and change the speed

Press Play, then jump over the cactus. Move the speed slider to try a slower or faster game; it switches to a fixed speed. Select the recovered rule to start at 6 and gradually accelerate again.

Play the reconstruction

6 → 10 → 13

Original rule: start at 6, then increase toward 13.

Move the slider to set your own speed. Space or Jump clears a cactus.

Read the script REA returned

We inspected wayou’s Chromium-derived browser edition with REA. It returned the loaded index.js, including this branch in the game’s update function:

REA · selected script source
if (this.currentSpeed < this.config.MAX_SPEED) {
  this.currentSpeed += this.config.ACCELERATION;
}

The settings are SPEED: 6, ACCELERATION: 0.001 and MAX_SPEED: 13. The game runs this branch on an update without a collision.

Use the same rule in the new game

Reconstruction · dino-speed.js
function advanceSpeed(speed) {
  return speed < 13 ? speed + 0.001 : speed;
}

The mini-game uses this function for automatic acceleration. Moving the slider supplies a fixed speed instead. Drawing, jump physics and rectangle collision checks are new code for this teaching game; its simulation advances at 60 updates per second.

Download the speed rule · Read the game code

Check the reconstruction

We called the original game’s update function with obstacles and automatic scheduling disabled. Compare those recorded speeds with a replay of the recovered rule.

Updates Original game Reconstructed rule
0 6.000 6.000
1,000 7.000 7.000
4,000 10.000 10.000
10,000 13.001 13.001

Values rounded to three decimals. The branch checks before adding, so the final increment can take speed just above 13.

Try the analysis yourself

  1. Set up REA with your coding agent.
  2. Follow the browser connection steps, using https://wayou.github.io/t-rex-runner/ as the page URL.
  3. Give your agent the page URL and local debugging endpoint, then copy this prompt.
Your coding agent

Use REA to inspect this dinosaur game. Why does it get faster? Show the speed rule, then build a small version with an adjustable speed.

Ask a follow-up: “Where is jump height calculated? Add a jump-height control to the new version.”

Source: inspected speed code, Chromium Authors. Copyright and BSD license. REA 4.1.0 inspected the running HTTP edition in Chrome 150.

Top