File size: 2,105 Bytes
5e4df86
 
 
7ee050d
5e4df86
5ef4f14
5e4df86
 
 
 
5ef4f14
 
7ee050d
 
5e4df86
7ee050d
 
5ef4f14
 
5e4df86
 
7ee050d
5ef4f14
7ee050d
 
5ef4f14
5e4df86
 
7ee050d
5ef4f14
5e4df86
 
 
 
 
5ef4f14
 
7ee050d
5e4df86
7ee050d
5ef4f14
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
def get_ganji_full(birth_date, birth_time, calendar_type):
    cheon = ["๊ฐ‘", "์„", "๋ณ‘", "์ •", "๋ฌด", "๊ธฐ", "๊ฒฝ", "์‹ ", "์ž„", "๊ณ„"]
    ji = ["์ž", "์ถ•", "์ธ", "๋ฌ˜", "์ง„", "์‚ฌ", "์˜ค", "๋ฏธ", "์‹ ", "์œ ", "์ˆ ", "ํ•ด"]
    elements = {"๊ฐ‘": "๋ชฉ(๋‚˜๋ฌด)", "์„": "๋ชฉ(๋‚˜๋ฌด)", "๋ณ‘": "ํ™”(๋ถˆ)", "์ •": "ํ™”(๋ถˆ)", "๋ฌด": "ํ† (ํ™)", "๊ธฐ": "ํ† (ํ™)", "๊ฒฝ": "๊ธˆ(์‡ )", "์‹ ": "๊ธˆ(์‡ )", "์ž„": "์ˆ˜(๋ฌผ)", "๊ณ„": "์ˆ˜(๋ฌผ)"}
    animals = {"์ž": "์ฅ", "์ถ•": "์†Œ", "์ธ": "๋ฒ”", "๋ฌ˜": "ํ† ๋ผ", "์ง„": "์šฉ", "์‚ฌ": "๋ฑ€", "์˜ค": "๋ง", "๋ฏธ": "์–‘", "์‹ ": "์›์ˆญ์ด", "์œ ": "๋‹ญ", "์ˆ ": "๊ฐœ", "ํ•ด": "๋ผ์ง€"}

    year = birth_date.year
    y_idx = year - 4
    y_stem = cheon[y_idx % 10]
    y_branch = ji[y_idx % 12]
    
    return {
        "text_data": f"{year}๋…„ {birth_date.month}์›” {birth_date.day}์ผ {birth_time.hour}์‹œ ({calendar_type})",
        "year_ganji": f"{y_stem}{y_branch}๋…„",
        "animal": animals[y_branch],
        "element": elements[y_stem],
        "desc": f"๋‹น์‹ ์€ {animals[y_branch]}๋ ์ด๋ฉฐ, {elements[y_stem]}์˜ ๊ธฐ์šด์„ ํƒ€๊ณ ๋‚ฌ์Šต๋‹ˆ๋‹ค."
    }

def get_fengshui_advanced(year, gender, door_dir, head_dir):
    digits_sum = sum(int(digit) for digit in str(year))
    while digits_sum > 9: digits_sum = sum(int(digit) for digit in str(digits_sum))
    
    if gender in ["๋‚จ์„ฑ", "Male"]: gua = 11 - digits_sum
    else: gua = digits_sum + 4
        
    while gua > 9: gua -= 9
    while gua < 1: gua += 9
    if gua == 5: gua = 2 if gender in ["๋‚จ์„ฑ", "Male"] else 8

    is_east = gua in [1, 3, 4, 9]
    group = "๋™์‚ฌํƒ (East Group)" if is_east else "์„œ์‚ฌํƒ (West Group)"
    good_dirs = ["๋ถ", "๋™", "๋‚จ", "๋‚จ๋™"] if is_east else ["๋ถ๋™", "๋‚จ์„œ", "์„œ", "๋ถ์„œ"]
    
    is_good_head = any(d in head_dir for d in good_dirs) or (head_dir in good_dirs)

    return {
        "gua": gua, "group": group, "good_dirs": ", ".join(good_dirs),
        "match": is_good_head,
        "advice": f"๊ท€ํ•˜๋Š” {group}์ž…๋‹ˆ๋‹ค. {head_dir} ๋ฐฉํ–ฅ์€ {'์ข‹์€' if is_good_head else '๋‚˜์œ'} ๊ธฐ์šด์ž…๋‹ˆ๋‹ค."
    }