oneshotlm
Compare all models on this prompt →

Reaction-diffusion · gemini-3-flash-preview

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 · 4 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
**Developing Inline Simulation**

I'm working on integrating a Gray-Scott reaction-diffusion simulation directly into a single HTML file. The goal is real-time Turing pattern generation, controllable via mouse input, all without external scripts or stylesheets. I've begun outlining the core chemical species, U and V, that will drive this process.

**Implementing WebGL Rendering**

I'm prioritizing WebGL for performance, opting for a ping-pong texture approach to manage state updates efficiently. My focus is on building a clean WebGL implementation within a single file, balancing functionality with conciseness for real-time Turing pattern generation.

**Drafting WebGL Pipeline**

I'm now detailing the core WebGL components. This involves setting up two textures for U and V states, alongside fragment shaders for updates and rendering. I'll implement a simple vertex shader for a full-screen quad and plan to use mouse input for localized perturbations. Default parameters for generating visually appealing Turing patterns are being selected.

**Optimizing Texture Data**

I'm focusing on efficient data representation for my simulation, specifically how to store the $U$ and $V$ chemical concentrations. While floating-point textures offer the best precision, I'll leverage WebGL2's capabilities, prioritizing `RGBA32F` or `RGBA16F` for optimal performance and visual fidelity. If those prove problematic, I'll consider scaling and offsetting with `RGBA8` as a fallback.

I will create a self-contained Gray-Scott reaction-diffusion simulation using WebGL2. This approach allows for high-performance, real-time calculations even at high resolutions, ensuring the "organic" feel of the Turing patterns. The simulation will feature: 1. **WebGL2 GPGPU Implementation**: Using ping-pong textures to compute the reaction-diffusion steps on the GPU. 2. **Organic Aesthetics**: A custom color mapping that gives the patterns a fluid, biological look. 3. **Interactive Seeding**: Mouse/Touch interaction to inject the "V" chemical and trigger new growth. 4. **Auto-Initialization**: The simulation starts with a pre-seeded center to show life immediately.

write index.html (13251 bytes)
toolResult

Successfully wrote 13251 bytes to index.html

assistant
thinking
**Developing WebGL2 Simulation**

I've initiated the web app with `index.html`, incorporating WebGL2 for an 8-step simulation per frame. The focus is on high-quality organic patterns using a 9-point Laplacian stencil, leveraging RG32F floating-point textures for enhanced simulation stability.

The Gray-Scott reaction-diffusion simulation is now ready in `index.html`. This implementation uses **WebGL2** to perform the heavy calculations on the GPU, allowing thousands of updates per second across the entire viewport. The "organic" feel is achieved through a specific parameter set for the Feed ($F$) and Kill ($k$) rates, a 9-point Laplacian stencil for smooth diffusion, and a custom gradient shader for the biological aesthetic. ### Key Features: - **Interactive Seeding**: Click, drag, or touch anywhere on the canvas to "feed" the reaction and watch new Turing patterns branch out from your path. - **High Performance**: The simulator runs 8 simulation steps per frame, ensuring the patterns grow and evolve at a natural, fluid pace. - **Organic Visuals**: The render pass uses a multi-layered color gradient (deep ocean blue to vibrant pink and white) and a subtle mathematical "shading" technique to give the patterns a 3D, biological texture. - **Self-Contained**: No external libraries or network requests; it runs entirely within the local browser sandbox. To view the simulation, simply open `index.html` in any modern web browser.

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

modelgemini-3-flash-preview
vendorGoogle
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Gray-Scott reaction-diffusion grows convincing coral-like Turing patterns that expand over time and with input.

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.6%
on click0.9%
on drag5.1%
on wheel4.4%
on enter + space4.0%
on arrow keys3.4%
on w/a/s/d4.4%
frame spread19.6 / 255
console errors0
js errors none

METRICS

runtime38.5s
tokens in7.8k
tokens out5.8k
cached0
cost / run$0.0214