L-system tree · deepseek-chat
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.
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
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.
Here's the complete `index.html` file with a procedural L-system fractal tree that sways gently in the wind using p5.js: 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; overflow: hidden; background-color: #f0f0f0; } canvas { display: block; } </style> </head> <body> <script src="p5.min.js"></script> <script> let axiom = "F"; let sentence = axiom; let len = 100; let angle; let rules = [ { a: "F", b: "FF+[+F-F-F]-[-F+F+F]" } ]; let windForce = 0; let windDirection = 1; function setup() { createCanvas(windowWidth, windowHeight); angle = radians(25); generate(4); background(240); } function draw() { background(240); push(); translate(width / 2, height); stroke(139, 69, 19); // Brown color for trunk strokeWeight(2); drawTree(); pop(); // Simulate wind windForce += 0.005 * windDirection; if (abs(windForce) > 0.1) { windDirection *= -1; } angle = radians(25 + windForce * 10); } function generate(iterations) { for (let i = 0; i < iterations; i++) { let nextSentence = ""; for (let c of sentence) { let matched = false; for (let rule of rules) { if (c === rule.a) { nextSentence += rule.b; matched = true; break; } } if (!matched) { nextSentence += c; } } sentence = nextSentence; len *= 0.5; } } function drawTree() { for (let c of sentence) { switch (c) { case "F": strokeWeight(len / 10); line(0, 0, 0, -len); translate(0, -len); break; case "+": rotate(angle); break; case "-": rotate(-angle); break; case "[": push(); break; case "]": pop(); break; } } } function windowResized() { resizeCanvas(windowWidth, windowHeight); } </script> </body> </html> This creates an L-system fractal tree with the following features: 1. Recursive branching using an L-system grammar ("F → FF+[+F-F-F]-[-F+F+F]") 2. Realistic swaying motion simulated with wind force 3. Adjustable branch angles that change with the wind 4. Brown trunk and branches with dynamic stroke weight 5. Responsive canvas that resizes with the window The tree grows procedurally and responds to simulated wind effects. All code is self-contained in `index.html` with no external dependencies except the local `p5.min.js`.
TAKE IT TO CODE
This run produced no artifact — reuse the prompt with a different model or your own pi-agent run.