This page answers one question: where the numbers in the engine come from, and what they were checked against. The site separates truth sources from cross-checks — the truth sources are its own generated tables and derivations, mutually verified before encoding; the open calendar library lunar-javascript is a cross-check, not an answer to copy.
Primary data the engine owns
Closed component tables. The 10 stems, 12 branches, 60 day pillars, hidden-stem tables, twelve stages, the 64-hexagram tables (King Wen order + the eight palaces) and 36 shen sha are produced by generator scripts whose built-in cross-checks refuse to emit a table that fails them.
The lichun instant table. 201 entries (1900–2100, Beijing time, minute-level) are generated offline and embedded; boundary years carry pinned gold values. Year-pillar, zodiac and kua-number switching all use it.
Glyphs and the King Wen order. Hexagram glyphs come from the Unicode block U+4DC0 onward (which follows the King Wen sequence) and are cross-checked against the 8×8 upper/lower matrix, an itemised list, and the sequence mnemonic.
The calendar library as a cross-check
lunar-javascript acts as a second opinion here: the engine derives first, then reconciles day by day against the library. The results are recorded on the methodology page:
Day officers: 628 consecutive days, zero mismatch
The 28 mansions: 900 consecutive days, zero mismatch
The 12 day spirits: 900 consecutive days, zero mismatch
Day na-yin: reconciled over 120 consecutive days
Mansion auspiciousness: 21 of 28 agree; the 7 divergences are all rated neutral and are published as facts, not smoothed away
Limits of the cross-check: the library has no reliable tables for the six harms, punishments or trines — those are hand-built truth tables verified by derivation (harm = clash ∘ combination, 12/12); term instants do not come from the library at all.
How the numbers are kept honest
Regression layer on top of the engine (numbers as published on the methodology page):
Luck-pillar arithmetic: a 4,939-assertion suite
Dual-engine equality: the Node engine and the in-browser engine are locked by byte-equal JSON comparison
Favourable element and compatibility: three-layer checks (truth tables × full scans × page smoke tests)
Site gates: per-page checks across the whole site for unique titles/descriptions, dead links, language cross-links and reachability
Classical texts — context, not code
The usual classical sources of this tradition, for further reading: Yuan Hai Zi Ping, San Ming Tong Hui, Qiong Tong Bao Jian, Di Tian Sui. Honest note: the calculations on this site depend on none of them directly — every table is generated and cross-checked as described above. These books explain why the components matter; they are not where numbers were copied from.
Frequently asked questions
Did you copy the data from some website?
No. Tables are produced by generator scripts with built-in cross-check assertions; the open calendar library lunar-javascript serves only as a day-by-day second opinion — the windows and results are recorded on the methodology page (day officers over 628 days; mansions and day spirits over 900 days, zero mismatch).
What happens when your engine and the library disagree?
First, establish which side is wrong. Divergences are published (the 7 mansion-auspiciousness disagreements rated neutral are listed one by one); a confirmed engine error goes to the corrections log. Tables are never silently changed.
Are the classical texts your authority?
Texts like Yuan Hai Zi Ping are the tradition’s sources, for further reading. The calculations depend on none of them directly — every table is generated and cross-checked in the open way described above.
Reference index
Every enumerable component of ba zi has its own page here. Each page is computed by the same engine and can be checked item by item — none of it is a personality table.