Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Chinese-zodiac/Mathematica/chinese-zodiac.math
Normal file
39
Task/Chinese-zodiac/Mathematica/chinese-zodiac.math
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
pinyin = <|"甲" -> "jiă", "乙" -> "yĭ", "丙" -> "bĭng", "丁" -> "dīng",
|
||||
"戊" -> "wù", "己" -> "jĭ", "庚" -> "gēng", "辛" -> "xīn",
|
||||
"壬" -> "rén", "癸" -> "gŭi", "子" -> "zĭ", "丑" -> "chŏu",
|
||||
"寅" -> "yín", "卯" -> "măo", "辰" -> "chén", "巳" -> "sì",
|
||||
"午" -> "wŭ", "未" -> "wèi", "申" -> "shēn", "酉" -> "yŏu",
|
||||
"戌" -> "xū", "亥" -> "hài"|>;
|
||||
animals = {"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse",
|
||||
"Goat", "Monkey", "Rooster", "Dog", "Pig"};
|
||||
elements = {"Wood", "Fire", "Earth", "Metal", "Water"};
|
||||
celestial = {"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"};
|
||||
terrestrial = {"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌",
|
||||
"亥"};
|
||||
aspects = {"yang", "yin"};
|
||||
ClearAll[calculate]
|
||||
calculate[year_] := Module[{BASE, cycleyear, stemnumber, stempinyin, element,
|
||||
elementnumber, branchnumber, branchhan, branchpinyin, animal,
|
||||
aspectnumber, aspect, stemhan},
|
||||
BASE = 4;
|
||||
cycleyear = year - BASE;
|
||||
stemnumber = Mod[cycleyear + 1, 10, 1];
|
||||
stemhan = celestial[[stemnumber]];
|
||||
stempinyin = pinyin[[stemhan]];
|
||||
elementnumber = Floor[stemnumber/2 + 1/2];
|
||||
element = elements[[elementnumber]];
|
||||
branchnumber = Mod[cycleyear + 1, 12, 1];
|
||||
branchhan = terrestrial[[branchnumber]];
|
||||
branchpinyin = pinyin[[branchhan]];
|
||||
animal = animals[[branchnumber]];
|
||||
aspectnumber = Mod[cycleyear + 1, 2, 1];
|
||||
aspect = aspects[[aspectnumber]];
|
||||
Row@{year, ": ", stemhan, branchhan, " (", stempinyin, "-", branchpinyin, ", ", element, " ", animal, "; ", aspect, ")"}
|
||||
]
|
||||
calculate[1935]
|
||||
calculate[1938]
|
||||
calculate[1941]
|
||||
calculate[1947]
|
||||
calculate[1968]
|
||||
calculate[1972]
|
||||
calculate[1976]
|
||||
Loading…
Add table
Add a link
Reference in a new issue