Palace object

The fields of Palace plus every star predicate, empty-palace check and flying-star method.

Palaces are where most Zi Wei analysis happens. chart.Palace(...) returns a *Palace, which both holds the palace's data and can trace back to its astrolabe, its opposite palace and its surrounded set.

soul := chart.Palace(iztro.PalaceSoul)

The examples on this page chart with "en-US", so the display values in the output are English. Every method on *Palace checks for a nil receiver and returns a zero value rather than panicking; reading a field still panics, so the nil check remains yours to make.

Fields

FieldTypeDescription
IndexintPalace index 0–11, where 0 is the Yin palace
Name / NameKeystringTranslated palace name / its key
IsBodyPalaceboolWhether this is the Body palace
IsOriginalPalaceboolWhether this is the palace of origin (stem equal to the year stem, and not the Zi or Chou palace)
HeavenlyStem / HeavenlyStemKeystringPalace stem, which determines the mutagens this palace flies out
EarthlyBranch / EarthlyBranchKeystringPalace branch, fixed by the index: 0 is yin, 11 is chou
MajorStars[]StarWhichever of the fourteen major stars fall here, in placement order
MinorStars[]StarWhichever of the fourteen minor stars fall here
AdjectiveStars[]StarAdjective stars
Changsheng12 / Changsheng12KeystringThe Changsheng god of this palace, exactly one per palace
Boshi12 / Boshi12KeystringThe Boshi god
Jiangqian12 / Jiangqian12KeystringThe Jiang-qian god
Suiqian12 / Suiqian12KeystringThe Sui-qian god
DecadalDecadalThe decadal: age range plus stem and branch
Ages[]intNominal ages at which the age scope passes through this palace
MutagenStarKeys[4]stringKeys of the four stars transformed by this palace's own stem, in the order lu, quan, ke, ji

The four groups of gods versus the three star groups

Major, minor and adjective stars are slices — a palace can hold zero or many. The Changsheng, Boshi, Jiang-qian and Sui-qian gods are marks of which each palace has exactly one, filling one full cycle across the twelve palaces, so they are single-valued fields rather than slices.

MutagenStarKeys is the palace-stem mutagen, not the natal one

It is computed from the mutagen table in effect when charting — a custom table (Config.Mutagens) shows up here, and it is exactly what the flying-star methods read. The natal mutagen is a mark on the star's own MutagenKey field; the two are not the same thing.

soul := chart.Palace(iztro.PalaceSoul)
fmt.Println(soul.HeavenlyStem, soul.MutagenStarKeys)

Output

ren [tianliangMaj ziweiMaj zuofuMin wuquMaj]

Has / NotHave / HasOneOf

Purpose Test which stars sit in this palace.

Zi Wei meaning Where stars fall is the basic information on a chart. "The Soul palace holds Ziwei and Tianxiang" is Has(StarZiweiMaj, StarTianxiangMaj). The search covers all three groups of major, minor and adjective stars.

Signature

func (p *Palace) Has(stars ...string) bool
func (p *Palace) NotHave(stars ...string) bool
func (p *Palace) HasOneOf(stars ...string) bool

Parameters

ParameterTypeRequiredDefaultDescription
stars...stringYesStar keys, variadic

Return value

MethodMeaning
HasEvery listed star is in this palace
NotHaveNone of the listed stars is in this palace
HasOneOfAt least one listed star is in this palace

Example

soul := chart.Palace(iztro.PalaceSoul)

fmt.Println(soul.Has(iztro.StarZiweiMaj, iztro.StarTianxiangMaj))
fmt.Println(soul.HasOneOf(iztro.StarQishaMaj, iztro.StarZiweiMaj))
fmt.Println(soul.NotHave(iztro.StarHuoxingMin, iztro.StarLingxingMin))

Output

false
true
true

On this chart the Soul palace holds only Ziwei, with Tianxiang in the Wealth palace, so Has — which demands both — is false.

Edge cases and pitfalls


HasMutagen / NotHaveMutagen

Purpose Test whether this palace carries a given mutagen.

Zi Wei meaning Natal mutagens are determined by the birth-year stem and marked on the corresponding stars. A palace "having Lu" means some star sitting in it was given Lu by the birth-year stem. Note this differs from flying stars — flying looks at the palace stem, while this looks at the mark already on the star.

Signature

func (p *Palace) HasMutagen(mutagenKey string) bool
func (p *Palace) NotHaveMutagen(mutagenKey string) bool

Parameters

ParameterTypeRequiredDefaultDescription
mutagenKeystringYesMutagenLu / MutagenQuan / MutagenKe / MutagenJi

Return value bool.

Example

children := chart.Palace(iztro.PalaceChildren)

fmt.Println("Children palace has lu:", children.HasMutagen(iztro.MutagenLu))
fmt.Println("Children palace lacks ji:", children.NotHaveMutagen(iztro.MutagenJi))

Output

Children palace has lu: true
Children palace lacks ji: true

Edge cases and pitfalls

Adjective stars are not scanned

HasMutagen looks only at the mutagen marks on MajorStars and MinorStars; an adjective star carrying a mark does not count (replicating iztro's behaviour). Natal mutagens only ever land on the fourteen major stars and a few minor ones, so in practice the two readings rarely differ on a real chart.


IsEmpty

Purpose Test whether this palace is empty.

Zi Wei meaning An "empty palace" holds none of the fourteen major stars. Empty palaces are read by borrowing the major stars of the opposite palace, and the test is a very common branch in Zi Wei analysis. Minor and adjective stars do not by default prevent a palace from counting as empty.

Signature

func (p *Palace) IsEmpty(excludeStars ...string) bool

Parameters

ParameterTypeRequiredDefaultDescription
excludeStars...stringNoStars that additionally count: with no major star but one of these present, the palace is not empty either

Return value bool. The order of decision is: major stars first — any present and it is not empty; then excludeStars — a hit and it is not empty; only if neither holds is the palace empty.

Example

parents := chart.Palace(iztro.PalaceParents)

fmt.Println("Parents palace empty:", parents.IsEmpty())
fmt.Println("Friends palace empty:", chart.Palace(iztro.PalaceFriends).IsEmpty())

// the Parents palace has no major star but does hold Tuoluo — counting Tuoluo makes it non-empty
fmt.Println("Parents palace counting Tuoluo:", parents.IsEmpty(iztro.StarTuoluoMin))

Output

Parents palace empty: true
Friends palace empty: false
Parents palace counting Tuoluo: false

On this chart only the Parents and Property palaces lack major stars. The Friends palace holds Taiyin and so is not empty.

Edge cases and pitfalls


FliesTo / FliesOneOfTo / NotFlyTo

Purpose Test whether the mutagens flown by this palace's stem land in a target palace.

Zi Wei meaning The core technique of the flying-star school. Every palace has its own stem, and the stem determines through the mutagen table which four stars take Lu, Quan, Ke and Ji. If a transformed star happens to sit in the target palace, that is "this palace flies X into the target palace". "The Soul palace flies Lu into Wealth" says that the smooth going of the Soul palace's affairs lands on wealth.

Signature

func (p *Palace) FliesTo(to *Palace, mutagenKeys ...string) bool
func (p *Palace) FliesOneOfTo(to *Palace, mutagenKeys ...string) bool
func (p *Palace) NotFlyTo(to *Palace, mutagenKeys ...string) bool

Parameters

ParameterTypeRequiredDefaultDescription
to*PalaceYesThe target palace object
mutagenKeys...stringYesThe mutagens to check

Return value

MethodMeaning
FliesToAll the listed mutagens fly into the target palace
FliesOneOfToAt least one of them flies into the target palace
NotFlyToNone of them flies into the target palace

Example

soul := chart.Palace(iztro.PalaceSoul)

fmt.Println("Soul flies lu into Wealth:",
    soul.FliesTo(chart.Palace(iztro.PalaceWealth), iztro.MutagenLu))
fmt.Println("Soul flies lu or ji into Surface:",
    soul.FliesOneOfTo(chart.Palace(iztro.PalaceSurface), iztro.MutagenLu, iztro.MutagenJi))
fmt.Println("Soul does not fly quan into Children:",
    soul.NotFlyTo(chart.Palace(iztro.PalaceChildren), iztro.MutagenQuan))

Output

Soul flies lu into Wealth: false
Soul flies lu or ji into Surface: false
Soul does not fly quan into Children: true

Edge cases and pitfalls


SelfMutaged / SelfMutagedOneOf / NotSelfMutaged

Purpose Test whether this palace self-mutates.

Zi Wei meaning A self-mutagen is when a star transformed by the palace's own stem happens to sit in that palace. It reads as "releasing its own energy back into itself", unlike the directed action of flying into another palace.

Signature

func (p *Palace) SelfMutaged(mutagenKeys ...string) bool
func (p *Palace) SelfMutagedOneOf(mutagenKeys ...string) bool
func (p *Palace) NotSelfMutaged(mutagenKeys ...string) bool

Parameters

ParameterTypeRequiredDefaultDescription
mutagenKeys...stringNoThe mutagens to check; passing none to the latter two methods means "all four"

Return value

MethodMeaning
SelfMutagedAll the listed mutagens are self-mutated
SelfMutagedOneOfAt least one of them is self-mutated; passing none checks all four
NotSelfMutagedNone of them is self-mutated; passing none checks all four

Example

career := chart.Palace(iztro.PalaceCareer)

fmt.Println("Career self-mutates lu:", career.SelfMutaged(iztro.MutagenLu))
fmt.Println("Career self-mutates ji:", career.SelfMutaged(iztro.MutagenJi))
fmt.Println("Career has any self-mutagen:", career.SelfMutagedOneOf())
fmt.Println("Career has no self-mutagen:", career.NotSelfMutaged())

Output

Career self-mutates lu: false
Career self-mutates ji: true
Career has any self-mutagen: true
Career has no self-mutagen: false

The Career palace's stem is bing, bing sends Ji to Lianzhen, and Lianzhen sits right in the Career palace — hence a self-mutated Ji.


MutagedPlaces / MutagenStars

Purpose Get which palaces the four stars transformed by this palace's stem land in, or get those four stars themselves.

Zi Wei meaning The panoramic version of flying-star analysis: instead of asking "does it fly to that palace?", collect all four landing places for Lu, Quan, Ke and Ji at once.

Signature

func (p *Palace) MutagedPlaces() []*Palace
func (p *Palace) MutagenStars(mutagenKeys ...string) []string

Return value MutagedPlaces returns a slice of length 4 in the order lu, quan, ke, ji, with nil in a slot whose transformed star is not on the chart. MutagenStars returns a slice of star keys in the order the mutagens were passed.

Example

soul := chart.Palace(iztro.PalaceSoul)

for i, m := range []string{"lu", "quan", "ke", "ji"} {
    if place := soul.MutagedPlaces()[i]; place != nil {
        fmt.Printf("%s%s\n", m, place.Name)
    } else {
        fmt.Printf("%s → not on this chart\n", m)
    }
}

fmt.Println(soul.MutagenStars(iztro.MutagenLu, iztro.MutagenJi))

Output

lu → children
quan → soul
ke → career
ji → wealth
[tianliangMaj wuquMaj]

The Soul palace's stem is ren, and ren sends Lu to Tianliang, Quan to Ziwei, Ke to Zuofu and Ji to Wuqu.


OppositePalace / SurroundedPalaces / Astrolabe

Purpose Trace from a palace to its opposite palace, its surrounded set and its astrolabe.

Signature

func (p *Palace) OppositePalace() *Palace
func (p *Palace) SurroundedPalaces() *SurroundedPalaces
func (p *Palace) Astrolabe() *Astrolabe

Return value A palace constructed on its own, detached from a chart, returns nil; a palace obtained from a chart query never does.

Example

soul := chart.Palace(iztro.PalaceSoul)

fmt.Println("the opposite of", soul.Name, "is", soul.OppositePalace().Name)
fmt.Println("malefics in the surrounded set:",
    soul.SurroundedPalaces().HaveOneOf(iztro.StarHuoxingMin, iztro.StarLingxingMin))
fmt.Println(soul.Astrolabe().FiveElementsClass)

Output

the opposite of soul is surface
malefics in the surrounded set: true
wood 3rd

Semantic text

Single-palace text lives not on *Palace but on the astrolabe method PalaceToText: the Go palace object is pure data, and the text projection recomputes statelessly from the chart's charting context.

text, _ := chart.PalaceToText(iztro.PalaceTarget{Index: p.Index})

On this page