Hello. I’m going to start by saying that I’m very new to coding. Sorry for my inexperience!

I’m trying to export a Barnsley fern code I found from Rosetta Code to an SVG. It needs to be SVG as it is for a vector art project that is not compatible with PDF files. I’ve tried using the methods found here but the problem seems to be the set line. Running the code as-is gives a “RuntimeException: No set() for PGraphicsSVG” error message.

I am admittedly out of my depth here, so I’m hoping that someone here will be able to help. I’ve pasted the code as I’ve tried to edit it:

```
import processing.svg.*;
void setup() {
size(325, 725);
background(219, 226, 233);
noLoop();
beginRecord(SVG, "Fern.svg");
}
float x = 0;
float y = 0;
void draw() {
for (int i = 0; i < 155000000; i++) {
float xt = 0;
float yt = 0;
float r = random(100);
if (r <= 1) {
xt = 0;
yt = 0.16*y;
} else if (r <= 8) {
xt = 0.20*x - 0.26*y;
yt = 0.23*x + 0.22*y + 1.60;
} else if (r <= 15) {
xt = -0.15*x + 0.28*y;
yt = 0.26*x + 0.24*y + 0.44;
} else {
xt = 0.85*x + 0.04*y;
yt = -0.04*x + 0.85*y + 1.60;
}
x = xt;
y = yt;
int m = round(width/2 + 60*x);
int n = height-round(60*y);
set(m, n, #009867);
}
endRecord();
}
```

And the original code from Rosetta Code, for sake of comparison:

```
import processing.svg.*;
void setup() {
size(325, 725);
background(219, 226, 233);
}
float x = 0;
float y = 0;
void draw() {
for (int i = 0; i < 155000000; i++) {
float xt = 0;
float yt = 0;
float r = random(100);
if (r <= 1) {
xt = 0;
yt = 0.16*y;
} else if (r <= 8) {
xt = 0.20*x - 0.26*y;
yt = 0.23*x + 0.22*y + 1.60;
} else if (r <= 15) {
xt = -0.15*x + 0.28*y;
yt = 0.26*x + 0.24*y + 0.44;
} else {
xt = 0.85*x + 0.04*y;
yt = -0.04*x + 0.85*y + 1.60;
}
x = xt;
y = yt;
int m = round(width/2 + 60*x);
int n = height-round(60*y);
set(m, n, #009867);
}
noLoop();
}
```

Thank you for any help you can provide!