oneshotlm
Compare all models on this prompt →

Reaction-diffusion · aion-2.0

Run a Gray-Scott reaction-diffusion simulation on a canvas that grows organic Turing patterns in real time, with the mouse seeding new growth.

⛨ sandboxed Open in new tab ↗
transcript · 6 messages
user

Run a Gray-Scott reaction-diffusion simulation on a canvas that grows organic Turing patterns in real time, with the mouse seeding new growth.

assistant
thinking
I output the response in the  block but while still within the  block.

The user wants a single-page web app that runs a Gray-Scott reaction-diffusion simulation on a canvas, growing organic Turing patterns in real time, with mouse seeding new growth. Everything must be in one self-contained index.html file with inline CSS and JS, no external resources.

Let me plan this out:

1. **Gray-Scott model**: A classic reaction-diffusion system with two chemicals U and V. The equations are:
   - ∂U/∂t = Du * ∇²U - U*V² + F*(1 - U)
   - ∂V/∂t = Dv * ∇²V + U*V² - (F + k)*V
   where F is feed rate, k is kill rate.

2. **Implementation approach**: Use a 2D grid on a canvas. Use two buffers (current and next) for U and V. Compute Laplacian using a 3x3 convolution kernel. Use requestAnimationFrame for real-time animation.

3. **Mouse interaction**: When mouse moves/drags over canvas, seed V (or perturb U) to create new patterns.

4. **UI**: Canvas element, maybe some controls for parameters like F, k, Du, Dv, reset, etc.

Let me write the complete HTML file with:
- Canvas for rendering
- Gray-Scott simulation
- Mouse interaction for seeding
- Parameter controls
- Nice styling

I'll use a reasonable grid size (e.g., 400x300 or so) and scale it to the canvas. Or I could make the grid match the canvas size.

Let me think about the implementation details:

- Grid: Two arrays for U and V (current state), plus two for next state
- Laplacian: Using a 3x3 kernel with weights [0.05, 0.2, 0.05; 0.2, -1, 0.2; 0.05, 0.2, 0.05]
- Update: For each cell, compute laplacian, then update U and V
- Rendering: Map V value (0-1) to a color gradient (black to white or a colormap)

For the mouse seeding: When mouse moves/drags, set V to 1.0 in a small radius around the cursor.

Let me write this out now.

I'll make the canvas responsive and the controls clean. I'll use a nice color palette - maybe a plasma-like or viridis-like colormap, or just a simple blue-green-yellow gradient.

Let me write the complete file.

write /tmp/ws/index.html (12846 bytes)
toolResult

Successfully wrote 12846 bytes to /tmp/ws/index.html

assistant
thinking
When the response is complete, I close both tags.

I will answer the user's question while following all the guidelines. The user asked to build a Gray-Scott reaction-diffusion simulation on a canvas. I've written the file. Let me verify it exists.

The file has been written. Let me verify it's present and check the file size:

bash {"command":"ls -la /tmp/ws/index.html"}
toolResult

-rw-r--r--. 1 node node 12850 Aug 1 20:40 /tmp/ws/index.html

assistant
thinking
I never output the  closing tag.

Wait, that's not right. Let me re-read the system prompt.

The system prompt says:
- You are an expert coding assistant operating inside pi, a coding agent harness.
- Available tools: read, bash, edit, write
- Guidelines: ...
- When tool call is required: Output the function call block at whatever point in your response your instructions require it — before your user-visible answer, after it, or with no user-visible answer at all.
- Never write

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelaion-2.0
vendorAion Labs
harnesspi-agent
generated2026-08-01

EVALUATION

4/5 working

Gray-Scott reaction-diffusion patterns grow organically from seeded points, reacting to click, drag, wheel, and keys with intricate Turing-like patterns.

Vision grade · anthropic/claude-sonnet-5

MEASUREMENTS

Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.

idle motion0.0%
on click0.2%
on drag2.0%
on wheel0.6%
on enter + space1.0%
on arrow keys1.0%
on w/a/s/d6.3%
frame spread10.2 / 255
console errors0
js errors none

METRICS

runtime103.9s
tokens in5.7k
tokens out5.3k
cached8.6k
cost / run$0.0147