let base = [[{ x: -200, y: 0 }, { x: 200, y: 0 }]]; const doc = [...Array(12)].reduce((doc_a, _, lvl) => { const rg = step => `0${(80 + (lvl - 2) * step).toString(16)}`.slice(-2); return doc_a + base.splice(0).reduce((ga, [a, b]) => { const w = (kx, ky) => (kx * (b.x - a.x) + ky * (b.y - a.y)) / 2; const [c, e, d] = [2, 3, 2].map((j, i) => ({ x: a.x + w(i, j), y: a.y + w(-j, i) })); base.push([c, e], [e, d]); return ga + `\n`; }, `\n`) + '\n'; }, '\n') + ''; const { x, y } = base.flat().reduce((a, p) => ({ x: Math.min(a.x, p.x), y: Math.min(a.y, p.y) })); const svg = doc.replace('