How Mio&Gem's BaZi tool works
Mio&Gem's tool is a BaZi (Eight Characters, 八字) reading engine built on Ziping School (子平派) algorithm + NOAA astronomical layer + true solar time correction. Birth time → crystal recommendation in four steps: chart extraction → Day Master (日主) strength → Yong Shen (用神) calculation → main crystal recommendation.
How does Mio&Gem's BaZi tool actually calculate your reading? Here's a look under the hood. From inputting your birth time to the tool surfacing a crystal recommendation, the path runs through several algorithmic layers, astronomical formulas, and the Yong Shen extraction logic. The piece closes with the tool's boundaries, what it can do and what it can't.
Table of contents
- The full pipeline
- NOAA astronomical algorithms + true solar time
- How Ziping School Yong Shen algorithm enters the recommendation
- The 18% threshold is a special case, not the main logic
- Where the algorithm's boundaries are
The full pipeline
Mio&Gem's tool is a BaZi reading engine built on Ziping School algorithm + NOAA astronomical layer + true solar time correction. From birth time input to crystal recommendation, the pipeline is four steps:
- Input birth time: year/month/day/hour + birth-location longitude/latitude + gender
- Compute the chart: with NOAA solar term correction + true solar time correction, derive year, month, day, and hour pillars
- Extract Yong Shen: based on Day Master strength, monthly command structure, and Five Elements (Wu Xing, 五行) generation/overcoming, calculate "the most useful" energy
- Recommend crystal: Yong Shen element × INTENT (general / wealth / love) → main stone
The full pipeline lives across four core internal modules (BaZi engine, recommendation engine, glossary, consumer view rendering layer). The whole algorithm is Ziping School, the chart structure and reading method differ entirely from other schools (Blind School, Zi Wei, etc.).
Each step's internal modules:
- Step 2 → BaZi extraction main function + four-pillar sub-functions
- Step 3 → full inference function + monthly command refinement step
- Step 4 → crystal mapping step (INTENT × Yong Shen → SKU table lookup)
These modules are internal architecture; you don't need to memorize them. Understanding the 4-step flow ("what each step does, why it works that way, what it outputs") is enough.
NOAA astronomical algorithms + true solar time
The tool's "hard science" layer is in step 2, going from civil birth time to a precise BaZi chart. Most BaZi software gets this rough; Mio&Gem uses minute-level precision.
NOAA astronomical algorithms: used to calculate exact solar term times.
Solar terms are the boundaries where the month pillar switches. For example, the precise moment of Lichun in 2026 decides the month pillar for anyone born around that time. Most lookup tables give "Lichun = February 4th" as a coarse marker, with errors up to several hours.
Mio&Gem's tool uses NOAA formulas (Newton's iteration on solar apparent longitude, 5 iterations) to compute solar terms with minute-level precision. That's about 10 times more precise than typical algorithms, for anyone born near a solar term boundary (24 solar terms per year, anyone born near any boundary could land in the wrong month pillar with a coarse tool), this 10x precision directly decides whether the month pillar is right.
True solar time correction: used to correct the birth moment.
Mean solar time (the time on the clock) differs from true solar time (the time corresponding to the sun's actual position) for two reasons:
- Longitude offset: clocks run by time zone, but each city's longitude differs. Each degree of longitude offset = 4 minutes of time offset. Beijing time uses the time of 120°E; in Singapore (103°E), what the clock shows as "noon" actually differs from the sun's actual position by about 68 minutes.
- Equation of Time: Earth's orbital eccentricity + axial tilt produces ±16 minutes of variation across the year.
The tool uses NOAA's standard Equation of Time formula, accurate to ±3 seconds (10x more precise than the Spencer formula). All BaZi calculations are based on true solar time, not mean solar time.
Why this much precision? Because Day Master and hour pillar both depend on the precision of birth moment. If birth time is near a solar term boundary plus a longitude offset, a coarse tool may give the wrong Day Master or hour pillar, and the wrong Day Master cascades into a fully wrong chart reading.
How Ziping School Yong Shen algorithm enters the recommendation
Step 3 is Yong Shen calculation, the most central layer of Mio&Gem's tool. The full Ziping School algorithm flow:
Step a: strength evaluation
The tool reads your chart's overall ratio and grades the Day Master strength into 6 levels: extremely strong, strong, mid-strong, mid-weak, weak, extremely weak. This is the internal "strength evaluation" step.
Judgment dimension: energy supporting you (same element + the element generating you) vs energy draining you (the element you generate + the element you overcome + the element overcoming you). Different ratios fall into different levels.
Step b: baseline Yong Shen
Based on the 6 strength levels, the tool gives a "baseline Yong Shen." This step is the internal "baseline Yong Shen calculation." Rules:
- Extremely strong / strong → restrain-and-channel mode; Yong Shen direction is "what you generate" or "what overcomes you"
- Mid-strong → light-channel mode; Yong Shen direction is "what you generate"
- Mid-weak → support mode; Yong Shen direction is "you" or "what generates you"
- Weak / extremely weak → strong-support mode; Yong Shen direction is "what generates you" + "you"
Step c: monthly command pattern refinement
The baseline Yong Shen still needs to be adjusted for the monthly command (the energy of your birth month). This step is the internal "monthly command refinement step," which considers your structure (the chart pattern set by the monthly command).
The Zi Ping Zhen Quan (Shen Xiaozhan, Qing Dynasty) states: "The Yong Shen of the Eight Characters must be sought from the Monthly Command. Pairing the Heavenly Stem of the Day with the Earthly Branch of the Monthly Command, differing relationships of generation and overcoming emerge, and from these, the structures (ge ju) are distinguished."
This is the core Ziping School algorithm refined over 800 years. Mio&Gem's "monthly command refinement step" corresponds directly to this principle, not "fill the lowest" but "calculate the most useful energy based on monthly command structure."
Step d: Yong Shen direction confirmed + crystal recommendation
Finally, Yong Shen + INTENT determine the specific crystal. For example:
- Yong Shen is Fire + general → Amethyst
- Yong Shen is Fire + wealth → Strawberry Quartz
- Yong Shen is Fire + love → Rose Quartz
The full mapping of Yong Shen × INTENT to crystals is the tool's internal INTENT_CRYSTAL_SKU data table (5 elements × 3 INTENTs = 15 combinations).
For more algorithmic detail: Xi Shen and Ji Shen decides the supporting stone and avoid list. See that piece.
The 18% threshold is a special case, not the main logic
This section is a key clarification. There's an 18% threshold in the tool's source code; some readers think "the tool's core algorithm is, recommend whichever Five Element falls below 18%." That's a misunderstanding.
Fact: the 18% threshold only triggers in Cong Ge (charts extremely tilted toward one element, a special case). Cong Ge charts are extremely rare, most charts are normal patterns and run the standard Ziping School algorithm described in §3.
What is Cong Ge?
Cong Ge is a class of extreme charts identified by Ziping School: the Day Master is too weak (< 8% of supporting roots) and one element dominates the entire chart. In this situation, the Day Master can't "stand alone" and must "follow" the dominant energy.
Ziping School identifies 6 Cong Ge types:
- Cong Cai Ge (weak Day Master, wealth element dominant)
- Cong Guan Ge (weak Day Master, officer element dominant)
- Cong Er Ge (weak Day Master, output element dominant)
- Cong Wang Ge (extreme self-element dominance, ≥ 65%)
- Cong Qiang Ge (self + supporter elements ≥ 70%)
- Hua Qi Ge (Day Master combines with another stem, with monthly command support)
In Cong Ge, the Yong Shen direction reverses, instead of supporting the Day Master, it follows the dominant energy.
Where does the 18% threshold trigger?
The tool's consumer view rendering layer has this logic:
If a Cong Ge chart is detected and the lowest-percentage element falls below 18%, the tool force-overrides the pro algorithm's Cong Ge Yong Shen and uses "Five Elements deficit-fill method" (directly fill the lowest-percentage element).
Why? Because the consumer interface needs visual consistency, if the tool shows you "Water at 5%" but recommends "Fire-element crystal" (the traditional Cong Ge theory), users get confused ("I'm lowest in Water, why isn't it recommending Water?").
So in this special case, Mio&Gem's tool gives the consumer "deficit-fill," visual (chart) and recommendation (main stone) align; trust doesn't break.
Important: the 18% threshold is not the tool's main logic. The vast majority of charts go through the §3 standard Yong Shen algorithm. 18% only triggers in Cong Ge + obvious deficit, an extreme case affecting a tiny fraction of charts.
Where the algorithm's boundaries are
Honestly: what the tool can do, and what it can't:
What the tool can do:
- Calculate Yong Shen, Xi Shen, Ji Shen
- Recommend the main stone (matching Yong Shen element + INTENT)
- Display current Da Yun + Liu Nian
- Adjust recommendations in real time as Da Yun / Liu Nian shift
What the tool can't do:
- Predict specific events ("Y will happen in month X")
- Give medical advice (the algorithm is not a medical tool)
- Replace deep consultation with a professional BaZi practitioner (especially around specific life decisions)
- Solve specific relationship / career / health issues
This is Mio&Gem's honest position: the tool is an energy analysis + object matching tool, not a fortune predictor, not a doctor, not a life coach. It gives you "a crystal recommendation matched to your energy structure"; the rest is your choice.
To run a reading and see the recommendation: BaZi reading. For the Ziping School academic foundation behind the algorithm: Ziping School vs other BaZi systems.
FAQ
How does the tool's algorithm differ from other apps?
Three main points: (1) uses real Ziping School algorithm, not LLM generation; (2) uses NOAA astronomical layer + true solar time correction, with precision 10x higher than typical tools; (3) recommendations are reproducible (same birth time, N runs gives identical results). Detailed comparison: Ziping School vs other BaZi systems.
Can I see the tool's specific calculation process?
The internal algorithm is from public sources (Ziping School standard + NOAA formulas), but the specific code is Mio&Gem's engineering work. If you're a developer wanting to verify the algorithm, you can hand-calculate the four pillars (with solar term lookup + true solar time correction) and compare with the tool's output. If you're a regular user, the tool surfaces the key calculation results in the recommendation explanation (what your Yong Shen is, why).
Can the tool make mistakes? (at the algorithm level)
The Ziping School core algorithm doesn't make mistakes (the algorithm is mathematically defined, not interpretive). But edge cases can give unexpected results: (1) birth time isn't precise enough (a 1-2 hour offset may cross a solar term); (2) without longitude/latitude, only rough computation is possible; (3) extremely rare special charts (Cong Ge, Hua Qi Ge) use simplified handling rather than full traditional theory. Mio&Gem's tool has guardrails for (2) and (3), but (1) depends on what you input.
What if I used the wrong birth time?
If off by a few minutes to an hour: the hour pillar may be wrong, but Day Master, month pillar, and year pillar usually stay the same. Re-enter the correct time and run again. If off by hours to a day: Day Master and month pillar may both shift, and the entire recommendation will change. If you don't know your precise birth time: run two versions (e.g., 6am vs 8pm) and compare; if both give the same recommendation, your reading isn't sensitive to time precision; if they differ, you need to find a more accurate time.
What features will the tool add later?
No major algorithmic changes planned in the short term, the Ziping School core + NOAA astronomical layer is stable. Future possibilities: (1) more detailed fortune reports (currently a simple version); (2) Liu Yue (monthly) level recommendation fine-tuning (currently to Liu Nian); (3) language expansion. Any algorithmic layer changes will be reflected in updates to the engine reference (internal documentation; public versions update when changes happen).
What the tool actually does, you can see by running the BaZi reading.