Mayan calendar: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
→‎{{header|Go}}: Made longCount function a bit tidier and added final Perl 6 example.
Thundergnat (talk | contribs)
→‎{{header|Perl 6}}: Tighten up task description verbiage a bit, remove a bunch of useless coercions
Line 13:
'''The Tzolk’in'''
 
The sacred cycle in the Mayan calendar round was called the '''Tzolk’in'''. The '''Tzolk'in''' has a cycle of 20 day names:
'''Tzolk'in''' has a cycle of 20 day names.
 
The twenty day names in the Maya Sacred Calendar are:
 
Imix’
Line 64 ⟶ 61:
and the end of the year, a special month of only 5 days, giving a total of 365.
The 5 days of the month of '''Wayeb’''' (the last month), are usually considered to be
a time of bad luck. This calendar is still used in parts of South America.
 
Each month in the '''Haab’''' has a name. The Mayan names for the civil months are:
Line 119 ⟶ 116:
(2) the day name in the '''Tzolk’in'''
(3) the day of the month in the '''Haab’'''
(4) the month name in the '''Haab’'''
 
A calendar round is a repeating cycle with a period of just short of 52
Line 170 ⟶ 167:
and Mayan calendars. The Gregorian calendar is full of jumps and skips to keep
the calendar aligned with the seasons so is much more difficult to work with.
correlates to in the Gregorian calendar. The most commonly used correlation
There is some disagreement over which date the current Mayan cycle beginning
correlates to in the Gregorian calendar. The most commonly used correlation
factor is The '''GMT: 584283'''. Julian 584283 is a day count corresponding '''Mon, Aug 11, 3114 BCE'''
in the Gregorian calendar, and the final day in the last Mayan long count
Line 356 ⟶ 352:
 
sub haab ($date, $factor = 'GMT') {
my $index = (offset Date.new($date) + %correlation{$factor}<round>[2] + offset $date) % 365;
my ($day, $month);
if $index > 360 {
Line 377 ⟶ 373:
 
sub tzolkin ($date, $factor = 'GMT') {
my $offset = offset Date.new($date);
1 + ($offset + %correlation{$factor}<round>[0]) % 13,
@sacred[($offset + %correlation{$factor}<round>[1]) % 20]
Line 383 ⟶ 379:
 
sub lord ($date, $factor = 'GMT') {
'G' ~ 1 + ((offset Date.new($date)) + %correlation{$factor}<round>[3] + offset $date) % 9
}
 
sub mayan-long-count ($date, $factor = 'GMT') {
my $days = %correlation{$factor}<long> + offset Date.new($date);
reverse $days.polymod(20,18,20,20);
}