{
const count = 9;
const sentences = [];
let start = "A";
for (let i = 0; i < count; i++) {
sentences.push((start = generate(start)));
}
function generate(input) {
let output = "";
for (let i = 0; i < input.length; i++) {
output += input.charAt(i) === "A" ? "AB" : "A";
}
return output;
}
const app = cm.app({
width: start.length * 0.7 + "em",
height: count + "em",
draw: cm.svg("text", sentences, {
textContent: (d, i) => `${i}: ${d}`,
dy: (_, i) => i + 1 + "em"
})
});
return app.render();
}