Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate Four Pillars requested by Jorge L. #124

Open
sengiv opened this issue Feb 27, 2024 · 0 comments
Open

Calculate Four Pillars requested by Jorge L. #124

sengiv opened this issue Feb 27, 2024 · 0 comments

Comments

@sengiv
Copy link
Contributor

sengiv commented Feb 27, 2024

FUNCTION calculateFourPillars(year, month, day, hour):
    # Define Heavenly Stems and Earthly Branches
    Heavenly_Stems = ["Jia", "Yi", "Bing", "Ding", "Wu", "Ji", "Geng", "Xin", "Ren", "Gui"]
    Earthly_Branches = ["Zi", "Chou", "Yin", "Mao", "Chen", "Si", "Wu", "Wei", "Shen", "You", "Xu", "Hai"]

    # Calculate the Stem and Branch for the Year
    year_stem_index = (year - 4) % 10
    year_branch_index = (year - 4) % 12
    year_stem = Heavenly_Stems[year_stem_index]
    year_branch = Earthly_Branches[year_branch_index]

    # Calculate the Stem and Branch for the Month
    month_stem_index = (year_stem_index * 2 + month - 1) % 10
    month_branch_index = (year_branch_index * 2 + month - 1) % 12
    month_stem = Heavenly_Stems[month_stem_index]
    month_branch = Earthly_Branches[month_branch_index]

    # Calculate the Stem and Branch for the Day
    day_stem_index = (year_stem_index + month_stem_index + day - 1) % 10
    day_branch_index = (year_branch_index + month_branch_ind
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant