oneshotlm
Compare all models on this prompt →

L-system tree · glm-5.2

Using the pre-provided p5.min.js (global p5), grow a procedural L-system fractal tree that branches recursively and sways gently in the wind.

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

Using the pre-provided p5.min.js (global p5), grow a procedural L-system fractal tree that branches recursively and sways gently in the wind.

assistant
thinking
Let me build a procedural L-system fractal tree that sways in the wind using p5.js. I'll create a self-contained index.html file.

Let me check what's in the current directory first.
bash {"command":"ls -la"}
toolResult

total 1028 drwxrwxrwx 3 node node 96 Jul 10 00:25 . drwxr-xr-x 1 root root 4096 Jul 10 00:25 .. -rw-r--r-- 1 node node 1034532 Jul 10 00:25 p5.min.js

assistant
thinking
Let me build a nice L-system fractal tree with wind sway. I'll make it visually appealing with:
- L-system rules to generate the tree structure
- Recursive branching
- Wind sway using noise/sine
- Nice colors, maybe gradients for sky and ground
- Leaves at the tips

Let me write the index.html.
write index.html (13179 bytes)
toolResult

Successfully wrote 13179 bytes to index.html

assistant
thinking
Let me verify it's valid and check it loads. Let me just confirm the file exists and looks right.
bash {"command":"ls -la index.html && head -c 200 index.html"}
toolResult

-rw-r--r-- 1 node node 13179 Jul 10 00:26 index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>L-System Fractal Tree in the Wind</title> <style> html, b

assistant

Done. I built `index.html` — a self-contained procedural L-system fractal tree swaying in the wind, using the bundled `p5.min.js`. **How it works:** - **L-system structure** — `buildTree()` expands a recursive branching grammar into a node graph (each node stores length, width, natural curve, children, and a leaf flag). Branching is probabilistic (2 branches, occasionally 3 for richer canopies) using a seeded RNG so each "New Tree" is reproducible but varied. - **Wind sway** — `windField()` combines slow Perlin noise with sine gusts biased by screen position. Sway is scaled by depth-from-root (`1.15^depth`), so the trunk barely moves while twig tips flutter a lot, and it's accumulated through parent links so whole subtrees bend coherently. - **Recursive rendering** — `drawBranch()` walks the node graph drawing thick tapered strokes (dark trunk → lighter twigs), with rounded caps for an organic look, and leaf clusters at the tips. - **Atmosphere** — dusk gradient sky, twinkling stars, a glowing moon, gradient ground with grass tufts, a trunk shadow, and drifting pollen particles spawned at the base and wherever you click. - **HUD controls** — sliders for Wind, Depth, Branch spread, and Trunk length (Depth/Angle/Length rebuild the tree live), a "New Tree" reseed button, plus mouse interaction: move the mouse to nudge the wind baseline, click to drop a seed burst. Open `index.html` in a browser to see it animate.

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

modelglm-5.2
vendorZ.ai · GLM
harnesspi-agent
generated2026-07-10

EVALUATION

4/5 working

Procedural L-system tree with leaves sways continuously in wind against a night sky with moon; sliders/UI present but tree looks consistent across inputs.

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 motion2.3%
on click3.0%
on drag2.8%
on wheel2.5%
on enter + space2.9%
on arrow keys2.9%
on w/a/s/d3.2%
frame spread20.1 / 255
console errors0
js errors none

METRICS

runtime91.8s
tokens in1.7k
tokens out4.9k
cached14k
cost / run$0.0188