fix: 신강·신약을 득령 먼저 보고 판정 — 월령 오행이 일간을 도우면 +0.15, 45~55%는 중화 (未월 己土가 시주 하나로 신약이 되던 문제)

This commit is contained in:
minaChoi committed 2026-10-29 13:30:50 +09:00
1 parent b9dd0f203d
commit 263f01b4f1
9 files changed
+43 -11

No files matched your search

+14 -3
View File
@@ -10,7 +10,10 @@ POSITION_POINTS = {
("year", "stem"): 10, ("year", "branch"): 10, ("month", "stem"): 10, ("month", "branch"): 30,
("day", "stem"): 10, ("day", "branch"): 20, ("hour", "stem"): 10, ("hour", "branch"): 10,
}
STRONG_FROM = 0.5 # 일간을 뺀 점수 중 비겁·인성 몫이 이 이상이면 신강
# 월령: 태어난 달의 오행. 일간 오행이 이와 같거나(왕) 달이 일간을 생하면(상) 득령. 강약은 득령을 먼저 본다
SEASON_ELEMENT = dict(zip("寅卯巳午申酉亥子辰戌丑未", "木木火火金金水水土土土土"))
DEUK_RYEONG_BONUS = 0.15 # 득령이면 돕는 몫에 더한다
STRONG_FROM, WEAK_BELOW = 0.55, 0.45 # (돕는 몫 + 득령 가산) 이 이상이면 신강, 미만이면 신약, 사이는 중화
@dataclass(frozen=True)
@@ -18,7 +21,12 @@ class Strength:
elements: dict[str, float] # 오행별 점수 (일간 포함), 木火土金水 순
top: str # 가장 센 오행
support: float # 일간을 뺀 점수 중 일간을 돕는 오행(같은 오행·생해 주는 오행) 몫 0~1
strong: bool
deuk_ryeong: bool
label: str # 신강 · 중화 · 신약
@property
def strong(self) -> bool:
return self.label == "신강"
def char_points(chart: Chart) -> list[tuple[str, str, str, float]]:
@@ -48,4 +56,7 @@ def chart_strength(chart: Chart) -> Strength:
support += points if el in helpers else 0.0
elements = {k: round(v, 1) for k, v in elements.items()}
ratio = round(support / others, 3)
return Strength(elements, max(elements, key=elements.get), ratio, ratio >= STRONG_FROM)
deuk = SEASON_ELEMENT[chart.month.branch] in helpers
judged = ratio + (DEUK_RYEONG_BONUS if deuk else 0.0)
label = "신강" if judged >= STRONG_FROM else "신약" if judged < WEAK_BELOW else "중화"
return Strength(elements, max(elements, key=elements.get), ratio, deuk, label)