Welcome to Orime!

    Choose your theme

    You can change it anytime.

    The Math of Divination

    The algorithm inside Zi Wei Dou Shu.

    Your Purple Star chart isn't interpreted — it's calculated.

    Every palace, every star position, every life-domain reading follows from a deterministic algorithm applied to your birth date, time, and gender. Here's how it works.

    01

    The structure

    108 stars. 12 palaces. One birth record.

    Zi Wei Dou Shu (紫微斗數) — Purple Star Astrology — organizes 108 named stars into a fixed grid of 12 life-domain palaces.

    The 12 palaces map to the main domains of a life: Life, Siblings, Spouse, Children, Wealth, Health, Travel, Friends, Career, Property, Karma, and Parents.

    Which star lands in which palace is determined entirely by your birth data: year, month, day, and hour in the Chinese lunisolar calendar, plus gender. No interpretation, no intuition — pure calculation.

    02

    Finding the Life Palace

    The first calculation anchors everything else.

    The Life Palace (命宮) is the foundation. Every other palace is defined relative to it in a fixed clockwise sequence.

    To find it, you need two numbers from your birth data: the birth month (1–12) in the Chinese calendar, and the birth hour branch (1–12) — the Earthly Branch corresponding to your two-hour birth window.

    Life Palace index = (birth_month + birth_hour_branch) mod 12

    The result is a number from 0 to 11, which maps to one of 12 fixed positions in the palace grid.

    Once the Life Palace is placed, all 11 remaining palaces fall into their positions automatically — they always appear in the same fixed order around the grid.

    Siblings
    Life
    Parents
    Wealth
    Career
    Karma
    Health
    Property
    Travel
    Friends
    Spouse
    Children
    The 12-palace grid. Life Palace (gold) is calculated first — all others are offset from it in fixed order.
    03

    Placing the emperor star

    Zi Wei's position depends on your birth day and Five Element Number.

    Zi Wei (紫微), the Purple Star, is the most important star in the system. Where it lands determines the character of the entire chart.

    Its palace is determined by two inputs: your lunar birth day (1–30), and your Five Element Number (五行局) — a value of 2, 3, 4, 5, or 6 derived from the year's Heavenly Stem and Earthly Branch pair.

    // Five Element Numbers by year stem-branch combination
    // 水二局 (Water 2), 木三局 (Wood 3), 金四局 (Metal 4)
    // 土五局 (Earth 5), 火六局 (Fire 6)
    
    function getZiWeiPalace(lunarDay, fiveElementNumber) {
      // Look up the Zi Wei position table for this element number
      // Each row is a birth day (1–30), value is palace index (0–11)
      return ZI_WEI_TABLE[fiveElementNumber][lunarDay - 1];
    }

    The Five Element Number sets the cycle length for the lookup table. A cycle of 2 means Zi Wei moves through the 12 palaces faster as birth days increase; a cycle of 6 means it moves more slowly.

    Once Zi Wei is placed, all other major stars — Tian Ji, Tai Yang, Wu Qu, Tian Tong, and the remaining 103 — follow at fixed offsets from Zi Wei's position. The whole chart unfolds from that one anchor.

    04

    How many distinct charts exist

    43,200 raw combinations reduce to roughly 1,728 distinct configurations.

    On paper, the input variables multiply out to a large number of combinations:

    12 months × 12 hour branches × 30 days × 5 element numbers × 2 genders = 43,200

    But many of these produce identical palace and star configurations. When you collapse redundant outcomes, the number of meaningfully distinct chart types is approximately 1,728 — which is 12³.

    Compare that to Western astrology, where birth time is often omitted entirely. Zi Wei requires the birth hour — without it, the Life Palace can't be calculated and the whole chart is undefined.

    That's not a limitation. It's the system being precise about what it needs.

    1

    Birth date + time + gender

    2

    Convert to Chinese lunisolar calendar

    3

    Find birth month & hour branch (1–12)

    4

    Life Palace = (month + hour branch) mod 12

    5

    Anchor palace grid to Life Palace

    6

    Assign Zi Wei star by birth day + Five Element Number

    7

    Place remaining 107 stars by fixed offsets from Zi Wei

    The Zi Wei Dou Shu calculation pipeline. Every step is deterministic — same birth data always produces the same chart.

    The short version

    Life PalaceAnchors the grid. Calculated from birth month + hour branch mod 12.
    Zi Wei starPlaced by birth day + Five Element Number. Anchors all other stars.
    Remaining 107 starsFixed offsets from Zi Wei. No additional calculation needed.
    Distinct charts~1,728 meaningful configurations from 43,200 raw inputs.
    Birth hour requiredWithout it, the Life Palace is undefined. The chart cannot be cast.

    References: Ho Peng Yoke (1985). Li, Qi and Shu: An Introduction to Science and Civilization in China. — Traditional Zi Wei Dou Shu manuals (梁若瑜紫微斗數全書).