| name | yi |
| description | Yi Jing divination skill - uses coin toss simulation to generate hexagrams, provides interpretation and AI analysis. |
Yi Jing Divination
Trigger
Use when user needs divination:
- "Help me divine"
- "Cast a hexagram"
- "Do a reading"
- "Yi Jing divination"
Divination Process
Step 1: Get Question
Method 1: User input directly
Ask: "What would you like to ask about?"
Method 2: Provide templates
If user unsure, offer common questions:
- Career (work, promotion, entrepreneurship)
- Wealth (investment, finances, income)
- Relationships (love, marriage)
- Academics (exams, education)
- Health
- Travel
- Other
Step 2: Cast Hexagram
Call performDivination(question) from src/divination.js:
- Toss coins 6 times (simulate 3 coins)
- Record each result (old yang, young yang, old yin, young yin)
- Determine moving yao (if any)
- Calculate main hexagram and changing hexagram
Step 3: Output Hexagram
Call formatOutput(divinationResult):
- Question
- 6 toss results
- Hexagram symbols (Unicode)
- Gua ci (judgments) and yao ci (line judgments)
- Moving yao explanation (if any)
Step 4: AI Interpretation
Call generateAIPrompt(question, divinationResult), then use LLM for interpretation.
Requirements:
- Classical Chinese style but modern understandable
- Answer:
- Overall meaning of hexagram
- Fortune for user's question
- Suggestions
- (If changing hexagram) What it means
Data Files
data/8-gua.json
8 trigrams:
- ไนพ, ๅ
, ็ฆป, ้, ๅทฝ, ๅ, ่ฎ, ๅค
- Symbol, nature, yin/yang, number
data/64-gua.json
64 hexagrams:
- Name, full name, gua ci, xiang, yao ci, liu qin, shi/ying
Core Functions
| Function | Description |
|---|
| yaoGua() | Simulate coin toss, return old/young yin/yang |
| yaoLiuCi() | Toss 6 times for complete hexagram |
| calcGua(yaos) | Calculate trigram numbers from yao |
| getGuaName(yaos) | Get hexagram name and symbol |
| getZhuAndBianGua(yaos) | Get main and changing hexagram |
| getGuaData(guaInfo) | Get detailed hexagram data |
| performDivination(question) | Execute full divination |
| formatOutput(divinationResult) | Format output |
| generateAIPrompt(question, result) | Generate AI prompt |
Output Example
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
YI JING DIVINATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ใQuestionใ
"My career development?"
ใTossing Processใ
1st: โโโ โ Yin (old yin) โฆ moving
2nd: โโโ โ Yin (young yin)
3rd: โโโ โ Yang (old yang) โฆ moving
4th: โโโ โ Yang (young yang)
5th: โโโ โ Yin (young yin)
6th: โโโ โ Yang (young yang)
ใHexagramใ
Main: Xun (Wind) โด
Change: Gen (Mountain) โถ
Moving yao: First, Top (becomes Gen)
ใInterpretationใ
ใGua Ciใ"Xiao Heng Li You Wang, Li Jian Da Ren"
ใXiangใ"Following wind, jun zi yi shen ming shi shi"
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
AI Interpretation Example
Based on hexagram, AI should include:
Hexagram Overview
Xun (Wind) hexagram, above and below Xun, wind blows everywhere... Gua ci means "Gradual success, beneficial to see great person."
Analysis
- Currently in "advance/retreat" phase - indicates hesitation in career choices
- Xun represents wind, characteristic is "enter" - need to seize timing
- Moving yao indicates transformation period
Fortune
Overall: Good with challenges
- Initial difficulties
- Good outcome with proper approach
- Key: "Li Jian Da Ren" - seek experienced guidance
Suggestions
- Go with the flow - leverage external forces
- Balance flexibility with firm resolve
- Seize opportunities - wind goes everywhere
- Seek mentorship
Changed Hexagram (Gen)
Gen means mountain - stability after changes. Stop and reflect before advancing.
Note: Yi Jing divination is for entertainment only. Major decisions require rational analysis.
Notes
- Entertainment only - not sole basis for major decisions
- Sincerity reminder - if same question asked repeatedly, note "lack of sincerity"
- Respect - maintain humble attitude
- Rational view - "do your best, leave rest to fate"
Hexagram Symbols
| Name | Symbol | Represents |
|---|
| ไนพ | โฐ | Heaven |
| ๅ
| โฑ | Lake |
| ็ฆป | โฒ | Fire |
| ้ | โณ | Thunder |
| ๅทฝ | โด | Wind |
| ๅ | โต | Water |
| ่ฎ | โถ | Mountain |
| ๅค | โท | Earth |
Yao Explanations
- Old Yang (โ): Yang changes to Yin
- Young Yang (โ): Yang, unchanged
- Old Yin (โ): Yin changes to Yang
- Young Yin (โ): Yin, unchanged
Moving yao represents direction of change - key to interpretation.