oneshotlm
Compare all models on this prompt →

L-system tree · llama-4-scout

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.

⚠ no runnable output

This one-shot run produced no runnable artifact.

agent produced no index.html

The transcript below shows what the model did — read it to see why the one shot fell short.

transcript · 2 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

create a procedural L-system fractal tree that branches recursively and sways gently in the wind using the pre-provided p5.min.js, we will first need to set up the basic structure of the HTML file, including the script tag for p5.min.js and our own script. Then, we'll write the JavaScript code to generate the L-system fractal tree. Here's how you can do it: ```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</title> <style> body { margin: 0; background-color: #f0f0f0; } #canvas { border: 1px solid black; } </style> </head> <body> <canvas id="canvas" width="800" height="600"></canvas> <script src="p5.min.js"></script> <script> let angle = 30; let treeDepth = 10; let shrinkFactor = 0.7; let axiom = 'X'; let sentence = axiom; let rules = { 'X': 'F+[[X]-X]-F[-FX]+X', 'F': 'FF' }; function generate(iterations) { for (let i = 0; i < iterations; i++) { let newSentence = ''; for (let j = 0; j < sentence.length; j++) { if (sentence[j] in rules) { newSentence += rules[sentence[j]]; } else { newSentence += sentence[j]; } } sentence = newSentence; } } function drawTree() { background(220); stroke(0); noFill(); translate(width / 2, height); strokeWeight(2); angleMode(DEGREES); generate(treeDepth); let stack = []; for (let i = 0; i < sentence.length; i++) { let c = sentence[i]; if (c === 'F') { line(0, 0, 0, -5); translate(0, -5); } else if (c === '+') { rotate(angle); } else if (c === '-') rotate(-angle); } else if (c === '[') { stack.push([x, y, angle]); } else if (c === ']') { [x, y, angle] = stack.pop(); } } } function setup() { createCanvas(800, 600); frameRate(30 angleMode(DEGREES); } function draw() { background(220, 10); drawTree(); // sway angle = 30 + sin(frameCount * 0.01) * 10; } </scriptbody> </html> ``` This code does the1. **Setup Canvas**: It creates an 800x600 canvas for drawing. 2. **L-System Rules**: Defines the axiom, sentence, and rules for the L-system. The axiom is 'X', and the rules are 'X' -> 'F+[[X]-X]-F[-FX]+X' and 'F' -> 'FF'. 3. **Generate L-System**: The `generate` function applies the L-system rules iteratively to create the sentence that represents the tree's branches. 4. **Draw Tree**: The `drawTree` function interprets the generated sentence as commands to draw the tree. 'F' moves forward, '+' and '-' turn right and left, and '[' and ']' push and pop the current position and angle onto a stack, allowing the tree to branch. 5. **Animation**: The `draw` function continuously draws the tree with a slight variation in the angle to simulate swaying in the wind. You can adjust parameters like `angle`, `treeDepth`, and `shrinkFactor` to experiment with different tree shapes and behaviors.

TAKE IT TO CODE

This run produced no artifact — reuse the prompt with a different model or your own pi-agent run.

RUN

modelllama-4-scout
vendorMeta · Llama
harnesspi-agent
generated2026-08-02

METRICS

runtime9.8s
tokens in1.5k
tokens out926
cached0
cost / run$0.0004