oneshotlm
Compare all models on this prompt →

L-system tree · kimi-k2.5

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 · 4 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
The user wants a procedural L-system fractal tree using p5.js (already provided as p5.min.js). Requirements:
- Single index.html file
- Self-contained, no external resources except p5.min.js loaded locally
- L-system fractal tree that branches recursively
- Gentle swaying in the wind effect
- CSS in <style>, JS in <script>

I need to create an L-system implementation. The L-system will have:
- Axiom (start string)
- Production rules (e.g., F -> F[+F]F[-F]F or similar for branching)
- Angle for turning
- Length for segments
- Iterations to generate the string

For the swaying effect, I'll use a time-based offset (sin/cos functions) applied to the rotation angles, simulating wind. I can use noise() or sin() for organic movement.

Structure:
1. HTML boilerplate
2. CSS for full-screen canvas
3. p5.js script:
   - L-system setup with axiom and rules
   - String generation through iterations
   - Turtle graphics interpretation of the L-system string
   - Wind effect using frameCount and sin()

I'll use a classic tree-like L-system:
- Axiom: "F"
- Rule: F -> FF+[+F-F-F]-[-F+F+F] or something similar that creates branching
- Angle: around 25 degrees
- Recursive depth: 4-5 iterations

For the wind effect, I'll modulate the rotation angle based on:
- Depth in the tree (branches sway less or more depending on level)
- Time (sin wave)
- Possibly some noise for irregularity

Let me write the code.
write /workspace/index.html (4991 bytes)
toolResult

Successfully wrote 4991 bytes to /workspace/index.html

assistant
thinking
The code is complete. Let me verify it's a valid L-system implementation:

1. Uses p5.min.js locally - ✓
2. Self-contained single HTML file - ✓
3. L-system with axiom "F" and rule that creates branching - ✓
4. Turtle graphics interpretation using F, +, -, [, ] - ✓
5. Wind effect using sin() based on frameCount and depth - ✓
6. Gradual color change from brown to green - ✓
7. Background with stars - ✓

The implementation looks correct. The wind calculation uses multiple sine waves for organic movement, and depth-based wind influence makes outer branches sway more than the trunk.

The index.html file has been created with a procedural L-system fractal tree. Key features: - **L-System**: Uses axiom "F" with recursive branching rule `FF+[+F-F-F]-[-F+F+F]` for 5 iterations, generating a complex tree structure - **Turtle Graphics**: Interprets F (forward), +/- (turn), [] (branch) commands to render the tree - **Wind Simulation**: Multiple sine waves create organic swaying motion, with deeper branches swaying more than the trunk - **Visual Polish**: Gradient coloring from brown (trunk) to green (leaves), varying stroke thickness, starry background gradient - **Zero Dependencies**: Uses only the provided p5.min.js, no network requests Open index.html in a browser to see the gently swaying fractal tree.

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

modelkimi-k2.5
vendorMoonshot · Kimi
harnesspi-agent
generated2026-07-22

EVALUATION

2/5 partial

A blob-like tree with foliage sways slightly, but lacks visible branching structure of an L-system fractal.

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.9%
on click0.6%
on drag2.5%
on wheel1.1%
on enter + space1.4%
on arrow keys1.5%
on w/a/s/d2.0%
frame spread14 / 255
console errors0
js errors none

METRICS

runtime51.2s
tokens in2.0k
tokens out1.9k
cached2.0k
cost / run$0.0048