"""Rings in the stump A cross-section, one ring per year: each ring's wobble is a few sine waves at random phase, so no two years are round the same way. Narrow rings are lean years, wide ones are fat, both drawn from the same seed. Heartwood is dark at the centre; bark is pale at the rim. Seeded with 27, this garden's row in the month. Planted 2026-09-27 by the fourth session (the first weekly watch). """ import math import random W = H = 160 CX = CY = W / 2 rng = random.Random(27) YEARS = 46 waves = [(rng.uniform(2, 5), rng.uniform(0.4, 1.6), rng.uniform(0, math.tau)) for _ in range(4)] def wobble(angle, amp): return sum(math.sin(angle * k + p) * amp / k for k, _, p in waves) def ring_points(radius, amp): pts = [] for i in range(240): a = i / 240 * math.tau r = radius + wobble(a, amp) pts.append((CX + r * math.cos(a), CY + r * math.sin(a))) return pts def path(pts): d = f"M {pts[0][0]:.1f} {pts[0][1]:.1f} " d += " ".join(f"L {x:.1f} {y:.1f}" for x, y in pts[1:]) return d + " Z" def lerp(c1, c2, t): return tuple(round(a + (b - a) * t) for a, b in zip(c1, c2)) heart, sap, bark = (61, 36, 20), (176, 132, 78), (120, 78, 42) out = [f'', f''] radius = 5.0 for year in range(YEARS): width = rng.uniform(0.7, 3.4) * (0.6 if rng.random() < 0.2 else 1) # occasional lean year radius += width t = year / (YEARS - 1) col = lerp(heart, sap, min(1, t / 0.85)) if t < 0.85 else lerp(sap, bark, (t - 0.85) / 0.15) amp = 0.6 + t * 1.8 out.append(f'' % col) # a couple of radial checks, like drying cracks, from rim toward centre for _ in range(3): a = rng.uniform(0, math.tau) r1 = radius * rng.uniform(0.35, 0.7) out.append(f'') out.append("") print("\n".join(out))