Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,116 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
|
||||
procedure Main is
|
||||
|
||||
type Element_Index is mod 5;
|
||||
type Animal_Index is mod 12;
|
||||
type Stem_Index is mod 10;
|
||||
|
||||
type Animal_Array is array(Animal_Index range <>) of Unbounded_String;
|
||||
type Element_Array is array(Element_Index range <>) of Unbounded_String;
|
||||
type Stem_Array is array(Stem_Index range <>) of Unbounded_String;
|
||||
|
||||
|
||||
Ani_Arr : Animal_Array := (To_Unbounded_String ("Rat"),
|
||||
To_Unbounded_String ("Ox"),
|
||||
To_Unbounded_String ("Tiger"),
|
||||
To_Unbounded_String ("Rabbit"),
|
||||
To_Unbounded_String ("Dragon"),
|
||||
To_Unbounded_String ("Snake"),
|
||||
To_Unbounded_String ("Horse"),
|
||||
To_Unbounded_String ("Sheep"),
|
||||
To_Unbounded_String ("Monkey"),
|
||||
To_Unbounded_String ("Rooster"),
|
||||
To_Unbounded_String ("Dog"),
|
||||
To_Unbounded_String ("Pig"));
|
||||
|
||||
Bra_Arr : Animal_Array := (To_Unbounded_String ("子"),
|
||||
To_Unbounded_String ("丑"),
|
||||
To_Unbounded_String ("寅"),
|
||||
To_Unbounded_String ("卯"),
|
||||
To_Unbounded_String ("辰"),
|
||||
To_Unbounded_String ("巳"),
|
||||
To_Unbounded_String ("午"),
|
||||
To_Unbounded_String ("未"),
|
||||
To_Unbounded_String ("申"),
|
||||
To_Unbounded_String ("酉"),
|
||||
To_Unbounded_String ("戌"),
|
||||
To_Unbounded_String ("亥"));
|
||||
|
||||
Ele_Arr : Element_Array := (To_Unbounded_String ("Wood"),
|
||||
To_Unbounded_String ("Fire"),
|
||||
To_Unbounded_String ("Earth"),
|
||||
To_Unbounded_String ("Metal"),
|
||||
To_Unbounded_String ("Water"));
|
||||
|
||||
Ste_Arr : Stem_Array := (To_Unbounded_String ("甲"),
|
||||
To_Unbounded_String ("乙"),
|
||||
To_Unbounded_String ("丙"),
|
||||
To_Unbounded_String ("丁"),
|
||||
To_Unbounded_String ("戊"),
|
||||
To_Unbounded_String ("己"),
|
||||
To_Unbounded_String ("庚"),
|
||||
To_Unbounded_String ("辛"),
|
||||
To_Unbounded_String ("壬"),
|
||||
To_Unbounded_String ("癸"));
|
||||
|
||||
procedure Sexagenary (Year : Positive) is
|
||||
Base_Year : Positive := 1984;
|
||||
Temp : Natural := abs (Base_Year - Year);
|
||||
Temp_Float: Float := 0.0;
|
||||
|
||||
Ele_Idx : Element_Index := Element_Index'First;
|
||||
Ani_Idx : Animal_Index := Animal_Index'First;
|
||||
Ste_Idx : Stem_Index := Stem_Index'First;
|
||||
Result : Unbounded_String := Null_Unbounded_String;
|
||||
begin
|
||||
Result := Result & Year'Image & " is the year of ";
|
||||
|
||||
if Year >= Base_Year then
|
||||
Temp_Float := Float'Floor (Float (Temp) / Float (2));
|
||||
Ele_Idx := Element_Index (Natural (Temp_Float) mod 5);
|
||||
Result := Result & Ele_Arr (Ele_Idx) & " ";
|
||||
|
||||
Ani_Idx := Animal_Index (Temp mod 12);
|
||||
Result := Result & Ani_Arr (Ani_Idx) & " ";
|
||||
elsif Year < Base_Year then
|
||||
Temp_Float := Float'Ceiling (Float (Temp) / Float (2));
|
||||
Ele_Idx := Ele_Idx - Element_Index (Natural (Temp_Float) mod 5);
|
||||
Result := Result & Ele_Arr (Ele_Idx) & " ";
|
||||
|
||||
Ani_Idx := Ani_Idx - Animal_Index (Temp mod 12);
|
||||
Result := Result & Ani_Arr (Ani_Idx) & " ";
|
||||
end if;
|
||||
|
||||
if Year mod 2 = 0 then
|
||||
Result := Result & "(yang). ";
|
||||
else
|
||||
Result := Result & "(yin). ";
|
||||
end if;
|
||||
|
||||
Ani_Idx := Animal_Index'First;
|
||||
|
||||
if Year >= Base_Year then
|
||||
Ste_Idx := Stem_Index (Temp mod 10);
|
||||
Result := Result & Ste_Arr (Ste_Idx);
|
||||
|
||||
Ani_Idx := Animal_Index (Temp mod 12);
|
||||
Result := Result & Bra_Arr (Ani_Idx);
|
||||
elsif Year < Base_Year then
|
||||
Ste_Idx := Ste_Idx - Stem_Index (Temp mod 10);
|
||||
Result := Result & Ste_Arr (Ste_Idx);
|
||||
|
||||
Ani_Idx := Ani_Idx - Animal_Index (Temp mod 12);
|
||||
Result := Result & Bra_Arr (Ani_Idx);
|
||||
end if;
|
||||
|
||||
Put (To_String (Result));
|
||||
end Sexagenary;
|
||||
|
||||
arr : array(Positive range <>) of Positive := (1935, 1938, 1968, 1972, 1976, 1984, 1985, 2017);
|
||||
begin
|
||||
for I of arr loop
|
||||
Sexagenary (I);
|
||||
New_Line;
|
||||
end loop;
|
||||
end Main;
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
const char* animals[] = { "Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig" };
|
||||
const char* elements[] = { "Wood","Fire","Earth","Metal","Water" };
|
||||
|
||||
const char* getElement(int year) {
|
||||
int element = (int)floor((year - 4) % 10 / 2);
|
||||
return elements[element];
|
||||
}
|
||||
|
||||
const char* getAnimal(int year) {
|
||||
return animals[(year - 4) % 12];
|
||||
}
|
||||
|
||||
const char* getYY(int year) {
|
||||
if (year % 2 == 0) {
|
||||
return "yang";
|
||||
} else {
|
||||
return "yin";
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int years[] = { 1935, 1938, 1968, 1972, 1976, 2017 };
|
||||
int i;
|
||||
|
||||
//the zodiac cycle didnt start until 4 CE, so years <4 shouldnt be valid
|
||||
for (i = 0; i < 6; ++i) {
|
||||
int year = years[i];
|
||||
printf("%d is the year of the %s %s (%s).\n", year, getElement(year), getAnimal(year), getYY(year));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,17 +1,15 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">animals</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"Rat"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Ox"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Tiger"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Rabbit"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Dragon"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Snake"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Horse"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Goat"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Monkey"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Rooster"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Dog"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Pig"</span><span style="color: #0000FF;">},</span>
|
||||
<span style="color: #000000;">elements</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"Wood"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Fire"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Earth"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Metal"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Water"</span><span style="color: #0000FF;">},</span>
|
||||
<span style="color: #000000;">yinyang</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"yang"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"yin"</span><span style="color: #0000FF;">},</span>
|
||||
<span style="color: #000000;">years</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">1935</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1938</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1968</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1972</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1976</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2018</span><span style="color: #0000FF;">}</span>
|
||||
with javascript_semantics
|
||||
constant animals = {"Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"},
|
||||
elements = {"Wood","Fire","Earth","Metal","Water"},
|
||||
yinyang = {"yang","yin"},
|
||||
years = {1935,1938,1968,1972,1976,2018}
|
||||
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">years</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">year</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">years</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">],</span>
|
||||
<span style="color: #000000;">cycle</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">mod</span><span style="color: #0000FF;">(</span><span style="color: #000000;">year</span><span style="color: #0000FF;">-</span><span style="color: #000000;">4</span><span style="color: #0000FF;">,</span><span style="color: #000000;">60</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">string</span> <span style="color: #000000;">element</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">elements</span><span style="color: #0000FF;">[</span><span style="color: #7060A8;">floor</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">mod</span><span style="color: #0000FF;">(</span><span style="color: #000000;">cycle</span><span style="color: #0000FF;">,</span><span style="color: #000000;">10</span><span style="color: #0000FF;">)/</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">1</span><span style="color: #0000FF;">],</span>
|
||||
<span style="color: #000000;">animal</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">animals</span><span style="color: #0000FF;">[</span><span style="color: #7060A8;">mod</span><span style="color: #0000FF;">(</span><span style="color: #000000;">cycle</span><span style="color: #0000FF;">,</span><span style="color: #000000;">12</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">1</span><span style="color: #0000FF;">],</span>
|
||||
<span style="color: #000000;">yy</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">yinyang</span><span style="color: #0000FF;">[</span><span style="color: #7060A8;">mod</span><span style="color: #0000FF;">(</span><span style="color: #000000;">cycle</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">1</span><span style="color: #0000FF;">]</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d: %s %s; %s, year %d of the cycle.\n"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #0000FF;">{</span><span style="color: #000000;">year</span><span style="color: #0000FF;">,</span><span style="color: #000000;">element</span><span style="color: #0000FF;">,</span><span style="color: #000000;">animal</span><span style="color: #0000FF;">,</span><span style="color: #000000;">yy</span><span style="color: #0000FF;">,</span><span style="color: #000000;">cycle</span><span style="color: #0000FF;">+</span><span style="color: #000000;">1</span><span style="color: #0000FF;">})</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<!--
|
||||
for i=1 to length(years) do
|
||||
integer year = years[i],
|
||||
cycle = mod(year-4,60)
|
||||
string element = elements[floor(mod(cycle,10)/2)+1],
|
||||
animal = animals[mod(cycle,12)+1],
|
||||
yy = yinyang[mod(cycle,2)+1]
|
||||
printf(1,"%d: %s %s; %s, year %d of the cycle.\n",
|
||||
{year,element,animal,yy,cycle+1})
|
||||
end for
|
||||
|
|
|
|||
|
|
@ -1,85 +0,0 @@
|
|||
function Get-ChineseZodiac
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([PSCustomObject])]
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0)]
|
||||
[ValidateRange(1,9999)]
|
||||
[int]
|
||||
$Year = (Get-Date).Year
|
||||
)
|
||||
|
||||
Begin
|
||||
{
|
||||
$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'
|
||||
}
|
||||
|
||||
$celestial = '甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'
|
||||
$terrestrial = '子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥'
|
||||
$animals = 'Rat', 'Ox', 'Tiger', 'Rabbit', 'Dragon', 'Snake', 'Horse', 'Goat', 'Monkey', 'Rooster', 'Dog', 'Pig'
|
||||
$elements = 'Wood', 'Fire', 'Earth', 'Metal', 'Water'
|
||||
$aspects = 'yang', 'yin'
|
||||
|
||||
$base = 4
|
||||
}
|
||||
Process
|
||||
{
|
||||
foreach ($ce_year in $Year)
|
||||
{
|
||||
$cycle_year = $ce_year - $base
|
||||
|
||||
$stem_number = $cycle_year % 10
|
||||
$stem_han = $celestial[$stem_number]
|
||||
$stem_pinyin = $pinyin[$stem_han]
|
||||
|
||||
$element_number = [Math]::Floor($stem_number / 2)
|
||||
$element = $elements[$element_number]
|
||||
|
||||
$branch_number = $cycle_year % 12
|
||||
$branch_han = $terrestrial[$branch_number]
|
||||
$branch_pinyin = $pinyin[$branch_han]
|
||||
$animal = $animals[$branch_number]
|
||||
|
||||
$aspect_number = $cycle_year % 2
|
||||
$aspect = $aspects[$aspect_number]
|
||||
|
||||
$index = $cycle_year % 60 + 1
|
||||
|
||||
[PSCustomObject]@{
|
||||
Year = $Year
|
||||
Element = $element
|
||||
Animal = $animal
|
||||
Aspect = $aspect
|
||||
YearOfCycle = $index
|
||||
ASCII = "$stem_pinyin-$branch_pinyin"
|
||||
Chinese = "$stem_han$branch_han"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
1935, 1938, 1968, 1972, 1976 | Get-ChineseZodiac | Format-Table
|
||||
|
|
@ -1 +0,0 @@
|
|||
Get-ChineseZodiac
|
||||
|
|
@ -1 +0,0 @@
|
|||
Get-Date "11/8/2016" | Get-ChineseZodiac
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
$zodiacs = 1935, 1938, 1968, 1972, 1976 | Get-ChineseZodiac
|
||||
|
||||
foreach ($zodiac in $zodiacs)
|
||||
{
|
||||
"{0}: {1} ({2}, {3} {4}; {5} - year {6} of the cycle)" -f $zodiac.Year,
|
||||
$zodiac.Chinese,
|
||||
$zodiac.ASCII,
|
||||
$zodiac.Element,
|
||||
$zodiac.Animal,
|
||||
$zodiac.Aspect,
|
||||
$zodiac.YearOfCycle
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
' Chinese zodiac - VBS
|
||||
|
||||
Animals = array( "Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig" )
|
||||
Elements = array( "Wood","Fire","Earth","Metal","Water" )
|
||||
YinYang = array( "Yang","Yin" )
|
||||
Years = array( 1935, 1938, 1968, 1972, 1976, 1984, 2017 )
|
||||
|
||||
for i = LBound(Years) to UBound(Years)
|
||||
xYear = Years(i)
|
||||
yElement = Elements(((xYear - 4) mod 10) \ 2)
|
||||
yAnimal = Animals( (xYear - 4) mod 12 )
|
||||
yYinYang = YinYang( xYear mod 2 )
|
||||
nn = ((xYear - 4) mod 60) + 1
|
||||
msgbox xYear & " is the year of the " & yElement & " " & yAnimal & " (" & yYinYang & ").",, _
|
||||
xYear & " : " & nn & "/60"
|
||||
next
|
||||
Loading…
Add table
Add a link
Reference in a new issue