xxxxxxxxxx
34
var array = ['A'];
var n = 0;
function setup() {
createCanvas(400, 400);
for(var i = 0; i < 1; i++){
array = lSystem(array);
}
}
function lSystem(input){
let l = input.length;
var output = [];
var rule;
for(var i = 0; i < l; i++){
if(input[i] == 'A'){
rule = ['A','B','A'];
} else if (input[i] == 'B'){
rule = ['B','B','B']
}
for(let j = 0; j < rule.length; j++){
append(output,rule[j]);
}
}
return output;
}
function draw() {
background(220);
noLoop();
console.log(array);
}