I built BaZi Cue, a free calculator for BaZi’s Four Pillars, Day Master, and Five Elements.
The interesting engineering problem isn’t drawing a chart. It’s making a calendar-dependent result understandable without hiding the conventions that produced it.
Start with the calculation contract
For a project like this, "convert a birth date into a chart" is not a complete specification.
You need to decide what information the calculation accepts, which calendar conventions apply, and how boundary cases should behave. A result can look completely plausible while following different assumptions from the calculator beside it.
That means the calculation contract deserves the same attention as the interface.
A useful implementation model is input normalization, calendar conversion, pillar derivation, and presentation. These are architectural boundaries to think through, not a claim about a particular framework or library in the deployed application.
Keep derived values traceable
The Day Master is associated with the heavenly stem of the day pillar. It shouldn’t become a separate piece of state that can drift away from the chart.
The same principle applies to element-related output: labels and summaries should come from a consistent underlying representation.
If I were reviewing a similar calculator, I’d ask whether the display layer can accidentally disagree with the calculation layer. Duplicated lookup logic is an easy way to create that problem.
Test the boundaries, not just ordinary dates
The most useful test cases are often the least convenient ones.
Dates near relevant calendar transitions, time boundaries, and input-validation limits deserve explicit attention. Reference cases also need their assumptions recorded; otherwise, a disagreement between two calculators doesn’t tell you which implementation is wrong.
A good fixture explains both the expected output and the convention it assumes.
A note on the stack
BaZi Cue is a browser-accessible web calculator. I’m keeping this write-up focused on the calculation and presentation architecture rather than naming an unverified framework, hosting provider, or backend.
The transferable lesson is separation of concerns: calculation rules should be inspectable independently of UI choices.
Feedback I’d find useful
The site is free and doesn’t require an account.
I’d love feedback on the explanations, especially from developers familiar with calendrical software. What boundary cases would you test first? What would make a calculation rule sufficiently clear to reproduce?
Try BaZi Cue and tell me which assumption you’d want documented more explicitly.
Top comments (1)
'Calculation contract' is exactly the right name, and the plausible-result problem is the part I'd underline twice. Two calculators can both be internally correct and still disagree, because the disagreement lives in the conventions — which calendar, which boundary rule — not in the arithmetic. A user comparing them sees one number differ and concludes one is broken; neither is. I hit the same shape specifying agent work: if the brief doesn't state its assumptions, the worker fills the gaps silently and delivers a result that's plausible, polished, and built on a different contract than I meant. My rule since: assumptions get written at the top, in the open, where a reader can disagree with them — including the boundary cases, because boundaries are where contracts actually differ. Arithmetic is the easy part of any calculation. The contract is the product.