forked from warrially/BaziGo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhehuachong.go
More file actions
46 lines (38 loc) · 989 Bytes
/
hehuachong.go
File metadata and controls
46 lines (38 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package bazi
// THeHuaChong 荷花冲
type THeHuaChong struct {
}
// TTianGanWuHe 天干五合
type TTianGanWuHe struct {
}
// 甲己合化土, 乙庚合化金, 丙辛合化水, 丁壬合化木, 戊癸合化火。
func quickCheckTianGan(pGan1, pGan2 *TGan) (int, string) {
nGan1 := pGan1.Value()
nGan2 := pGan2.Value()
if nGan1 == nGan2 {
return -1, "" // 相同不合
}
nGan1 %= 5
nGan2 %= 5
if nGan1 < 0 {
nGan1 += 5
}
if nGan2 < 0 {
nGan2 += 5
}
if nGan1 == nGan2 {
switch nGan1 {
case 0:
return 4, "甲己合化土" // 甲 阳木 + 己 阴土 = 合化土
case 1:
return 0, "庚乙合化金" // 庚 阳金 + 乙 阴木 = 合化金
case 2:
return 2, "丙辛合化水" // 丙 阳火 + 辛 阴金 = 合化水
case 3:
return 1, "壬丁合化木" // 壬 阳水 + 丁 阴火 = 合化木
case 4:
return 3, "戊癸合化火" // 戊 阳土 + 癸 阴水 = 合化火
}
}
return -1, ""
}