September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,72 +1,118 @@
|
|||
/**
|
||||
* All Hail Discordia! - this script prints Discordian date using system date.
|
||||
* author: jklu, lang: JavaScript
|
||||
*
|
||||
* lang: JavaScript
|
||||
* author: jklu
|
||||
* contributors: JamesMcGuigan
|
||||
*
|
||||
* changelog:
|
||||
* - Modified to return same output syntax as unix ddate + module.exports - James McGuigan, 2/Chaos/3183
|
||||
*
|
||||
* source: https://rosettacode.org/wiki/Discordian_date#JavaScript
|
||||
*/
|
||||
var seasons = ["Chaos", "Discord", "Confusion",
|
||||
"Bureaucracy", "The Aftermath"];
|
||||
var weekday = ["Sweetmorn", "Boomtime", "Pungenday",
|
||||
"Prickle-Prickle", "Setting Orange"];
|
||||
var seasons = [
|
||||
"Chaos", "Discord", "Confusion",
|
||||
"Bureaucracy", "The Aftermath"
|
||||
];
|
||||
var weekday = [
|
||||
"Sweetmorn", "Boomtime", "Pungenday",
|
||||
"Prickle-Prickle", "Setting Orange"
|
||||
];
|
||||
|
||||
var apostle = ["Mungday", "Mojoday", "Syaday",
|
||||
"Zaraday", "Maladay"];
|
||||
var apostle = [
|
||||
"Mungday", "Mojoday", "Syaday",
|
||||
"Zaraday", "Maladay"
|
||||
];
|
||||
|
||||
var holiday = ["Chaoflux", "Discoflux", "Confuflux",
|
||||
"Bureflux", "Afflux"];
|
||||
var holiday = [
|
||||
"Chaoflux", "Discoflux", "Confuflux",
|
||||
"Bureflux", "Afflux"
|
||||
];
|
||||
|
||||
|
||||
Date.prototype.isLeapYear = function() {
|
||||
var year = this.getFullYear();
|
||||
if ((year & 3) !== 0) return false;
|
||||
if( (year & 3) !== 0 ) { return false; }
|
||||
return ((year % 100) !== 0 || (year % 400) === 0);
|
||||
};
|
||||
|
||||
// Get Day of Year
|
||||
Date.prototype.getDOY = function() {
|
||||
var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
||||
var mn = this.getMonth();
|
||||
var dn = this.getDate();
|
||||
var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
||||
var mn = this.getMonth();
|
||||
var dn = this.getDate();
|
||||
var dayOfYear = dayCount[mn] + dn;
|
||||
if (mn > 1 && this.isLeapYear()) dayOfYear++;
|
||||
if( mn > 1 && this.isLeapYear() ) { dayOfYear++; }
|
||||
return dayOfYear;
|
||||
};
|
||||
|
||||
function discordianDate(date) {
|
||||
var y = date.getFullYear();
|
||||
var yold = y + 1166;
|
||||
var dayOfYear = date.getDOY();
|
||||
Date.prototype.isToday = function() {
|
||||
var today = new Date();
|
||||
return this.getDate() === today.getDate()
|
||||
&& this.getMonth() === today.getMonth()
|
||||
&& this.getFullYear() === today.getFullYear()
|
||||
;
|
||||
};
|
||||
|
||||
if (date.isLeapYear()) {
|
||||
if (dayOfYear == 60)
|
||||
return "St. Tib's Day, in the YOLD " + yold;
|
||||
else if (dayOfYear > 60)
|
||||
function discordianDate(date) {
|
||||
if( !date ) { date = new Date(); }
|
||||
|
||||
var y = date.getFullYear();
|
||||
var yold = y + 1166;
|
||||
var dayOfYear = date.getDOY();
|
||||
var celebrateHoliday = null;
|
||||
|
||||
if( date.isLeapYear() ) {
|
||||
if( dayOfYear == 60 ) {
|
||||
celebrateHoliday = "St. Tib's Day";
|
||||
}
|
||||
else if( dayOfYear > 60 ) {
|
||||
dayOfYear--;
|
||||
}
|
||||
}
|
||||
dayOfYear--;
|
||||
|
||||
var divDay= Math.floor(dayOfYear/73);
|
||||
var divDay = Math.floor(dayOfYear / 73);
|
||||
|
||||
var seasonDay = (dayOfYear % 73) + 1;
|
||||
if (seasonDay == 5)
|
||||
return apostle[divDay] + ", in the YOLD " + yold;
|
||||
if (seasonDay == 50)
|
||||
return holiday[divDay] + ", in the YOLD " + yold;
|
||||
if( seasonDay == 5 ) {
|
||||
celebrateHoliday = apostle[divDay];
|
||||
}
|
||||
if( seasonDay == 50 ) {
|
||||
celebrateHoliday = holiday[divDay];
|
||||
}
|
||||
|
||||
var season = seasons[divDay];
|
||||
var season = seasons[divDay];
|
||||
var dayOfWeek = weekday[dayOfYear % 5];
|
||||
|
||||
return dayOfWeek + ", day " + seasonDay + " of " +
|
||||
season + " in the YOLD " + yold;
|
||||
var nth = (seasonDay % 10 == 1) ? 'st'
|
||||
: (seasonDay % 10 == 2) ? 'nd'
|
||||
: (seasonDay % 10 == 3) ? 'rd'
|
||||
: 'th';
|
||||
|
||||
return "" //(date.isToday() ? "Today is " : '')
|
||||
+ dayOfWeek
|
||||
+ ", the " + seasonDay + nth
|
||||
+ " day of " + season
|
||||
+ " in the YOLD " + yold
|
||||
+ (celebrateHoliday ? ". Celebrate " + celebrateHoliday + "!" : '')
|
||||
;
|
||||
}
|
||||
|
||||
function test(y, m, d, result) {
|
||||
console.assert((discordianDate(new Date(y, m, d)) == result), result);
|
||||
console.assert((discordianDate(new Date(y, m, d)) == result), [y, m, d, discordianDate(new Date(y, m, d)), result]);
|
||||
}
|
||||
|
||||
console.log(discordianDate(new Date(Date.now())));
|
||||
test(2010, 6, 22, "Pungenday, day 57 of Confusion in the YOLD 3176");
|
||||
test(2012, 1, 28, "Prickle-Prickle, day 59 of Chaos in the YOLD 3178");
|
||||
test(2012, 1, 29, "St. Tib's Day, in the YOLD 3178");
|
||||
test(2012, 2, 1, "Setting Orange, day 60 of Chaos in the YOLD 3178");
|
||||
test(2010, 0, 5, "Mungday, in the YOLD 3176");
|
||||
test(2011, 4, 3, "Discoflux, in the YOLD 3177");
|
||||
test(2015, 9, 19, "Boomtime, day 73 of Bureaucracy in the YOLD 3181");
|
||||
// Only run test code if node calls this file directly
|
||||
if( require.main === module ) {
|
||||
console.log(discordianDate(new Date(Date.now())));
|
||||
test(2010, 6, 22, "Pungenday, the 57th day of Confusion in the YOLD 3176");
|
||||
test(2012, 1, 28, "Prickle-Prickle, the 59th day of Chaos in the YOLD 3178");
|
||||
test(2012, 1, 29, "Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib's Day!");
|
||||
test(2012, 2, 1, "Setting Orange, the 60th day of Chaos in the YOLD 3178");
|
||||
test(2010, 0, 5, "Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!");
|
||||
test(2011, 4, 3, "Pungenday, the 50th day of Discord in the YOLD 3177. Celebrate Discoflux!");
|
||||
test(2015, 9, 19, "Boomtime, the 73rd day of Bureaucracy in the YOLD 3181");
|
||||
}
|
||||
|
||||
module.exports = discordianDate;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
console.log(discordianDate(new Date(Date.now())));
|
||||
"Prickle-Prickle, day 47 of The Aftermath in the YOLD 3181"
|
||||
"Boomtime, the 2nd day of Chaos in the YOLD 3183"
|
||||
|
|
|
|||
39
Task/Discordian-date/Julia/discordian-date.julia
Normal file
39
Task/Discordian-date/Julia/discordian-date.julia
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# v0.6.0
|
||||
using Dates
|
||||
|
||||
function discordiandate(year::Integer, month::Integer, day::Integer)
|
||||
const DISCORDIANSEASONS = ["Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"]
|
||||
const HOLIDAYS = Dict(
|
||||
"Chaos 5" => "Mungday",
|
||||
"Chaos 50" => "Chaoflux",
|
||||
"Discord 5" => "Mojoday",
|
||||
"Discord 50" => "Discoflux",
|
||||
"Confusion 5" => "Syaday",
|
||||
"Confusion 50" => "Confuflux",
|
||||
"Bureaucracy 5" => "Zaraday",
|
||||
"Bureaucracy 50" => "Bureflux",
|
||||
"The Aftermath 5" => "Maladay",
|
||||
"The Aftermath 50" => "Afflux",
|
||||
)
|
||||
today = Date(year, month, day)
|
||||
isleap = isleapyear(year)
|
||||
if isleap && month == 2 && day == 29
|
||||
rst = "St. Tib's Day, YOLD " * string(year + 1166)
|
||||
else
|
||||
dy = dayofyear(today)
|
||||
if isleap && dy >= 60
|
||||
dy -= 1
|
||||
end
|
||||
dday = string(DISCORDIANSEASONS[div(dy, 73) + 1], " ", rem(dy, 73))
|
||||
if haskey(HOLIDAYS, dday)
|
||||
rst = dday * " ($(HOLIDAYS[dday])), YOLD $(year + 1166)"
|
||||
else
|
||||
rst = dday * ", YOLD $(year + 1166)"
|
||||
end
|
||||
end
|
||||
return rst
|
||||
end
|
||||
|
||||
@show discordiandate(2017, 08, 15)
|
||||
@show discordiandate(1996, 02, 29)
|
||||
@show discordiandate(1996, 02, 19)
|
||||
|
|
@ -1,62 +1,82 @@
|
|||
<?php
|
||||
// Discordian dating machine. Accepts date from PHP function date() or from the URL.
|
||||
// The Discordian calendar has 5 days in a week, 73 days in a month and 5 months in a year.
|
||||
// Ex. ddate.php will generate todays date according to your computer
|
||||
// Ex. ddate.php?y=2012&m=2&y=29 will generate the date for Feb. 29, 2012
|
||||
$Anerisia = array(31,28,31,30,31,30,31,31,30,31,30,31);
|
||||
$MONTHS = array("Choas","Discord","Confusion","Bureacracy","The Aftermath");
|
||||
$DAYS = array("Setting Orange","Sweetmorn","BoomTime","Pungenday","Prickle-Prickle");
|
||||
$Dsuff = array('th','st','nd','rd','th','th','th','th','th','th');
|
||||
$Holy5 = array("Mungday","MojoDay","Syaday","Zaraday","Maladay");
|
||||
$Holy50 = array("Chaoflux","Discoflux","Confuflux","Bureflux","Afflux");
|
||||
|
||||
$DAYS = array("Sweetmorn","Boomtime","Pungenday","Prickle-Prickle","Setting Orange");
|
||||
$MONTHS = array("Chaos","Discord","Confusion","Bureaucracy","The Aftermath");
|
||||
|
||||
// If user passed year, month and day variables in URL
|
||||
if(isset($_GET['y']) && isset($_GET['m']) && isset($_GET['d'])) {
|
||||
// Get year, month and day from URL
|
||||
$usery = $_GET['y']; $userm = $_GET['m']; $userd = $_GET['d'];
|
||||
// Use unix time to calculate day of year starting at zero
|
||||
$userdate = mktime(0,0,0,$userm,$userd,$usery);
|
||||
$ddays = ($userdate - mktime(0,0,0,1,1,$usery)) / 86400;
|
||||
// Calculates the Discordian year, month and day
|
||||
$dyear = ($usery) + 1166; $dmonth = $MONTHS[$dday/73]; $dday = $ddays%73 + 1;
|
||||
}
|
||||
// If user didn't pass year, get date from PHP function
|
||||
else {
|
||||
// Create array containing current Gregorian year, month, day,
|
||||
// days of year starting at zero and whether or not year is a leap
|
||||
$date = explode(" ",date('Y n j z L'));
|
||||
// Calculates the Discordian year, month and day
|
||||
$dyear = $date[0]+1166; $dmonth = $MONTHS[$date[3]/73]; $dday = $date[3]%73 +1;
|
||||
}
|
||||
// Determine the name of the day
|
||||
if ($ddays === NULL) { $ddayname= $DAYS[$date[3]%5]; }
|
||||
else { $ddayname= $DAYS[$ddays%5]; }
|
||||
|
||||
// Leap year exception for date from PHP
|
||||
if ($ddays === NULL) {
|
||||
if ($date[4]) {
|
||||
if ($date[1] == 2 && $date[2] == 29) { echo "Today is St. Tib's Day, YOLD " . $dyear; }
|
||||
if ($date[3] >= 60) { //offset day by one if leap year
|
||||
$dday -= 1;
|
||||
if($dday % 5 == 0) $ddayname = $DAYS[4];
|
||||
else $ddayname = $DAYS[($dday%5)];
|
||||
}
|
||||
}
|
||||
// Display Discordian date
|
||||
echo "Today is " . $ddayname . ", " . $dmonth . " " . $dday . ", YOLD " . $dyear;
|
||||
}
|
||||
else { // Leap year exception for date from URL
|
||||
if ($usery % 100 == 0) { // leap year exception for years that are divisible by one hundred
|
||||
if ($usery % 400 == 0 && $userm == 2 && $userd == 29) { echo "Today is St. Tib's Day, YOLD " . $dyear; }
|
||||
}
|
||||
else if ($usery % 4 == 0) { // if the year is a leap year
|
||||
if ($userm == 2 && $userd == 29) { echo "Today is St. Tib's Day, YOLD " . $dyear; }
|
||||
elseif ($ddays >= 60) { // offset day by one if leap year
|
||||
$dday -=1;
|
||||
if($dday % 5 == 0) $ddayname = $DAYS[4];
|
||||
else $ddayname=$DAYS[($dday%5-1)];
|
||||
echo "Today is " . $ddayname . ", " . $dmonth . " " . $dday . ", YOLD " . $dyear;
|
||||
}
|
||||
else { echo "Today is " . $ddayname . ", " . $dmonth . " " . $dday . ", YOLD " . $dyear; }
|
||||
}
|
||||
// Display Discordian date
|
||||
else { echo "Today is " . $ddayname . ", " . $dmonth . " " . $dday . ", YOLD " . $dyear; }
|
||||
}
|
||||
?>
|
||||
|
||||
// Get the current system date and assign to some variables
|
||||
$edate = explode(" ",date('Y m j L'));
|
||||
$usery = $edate[0];
|
||||
$userm = $edate[1];
|
||||
$userd = $edate[2];
|
||||
$IsLeap = $edate[3];
|
||||
|
||||
// If the user supplied us with a date overide the one we got from the system.
|
||||
// If you could get the date from users browser via javascript and then call
|
||||
// this script with the users date. ddate.php?y=year&m=month&d=day mostly it
|
||||
// won't matter but if the server is in a different time zone to the user
|
||||
// There will be occasional incorrect results from the users POV.
|
||||
|
||||
if (isset($_GET['y']) && isset($_GET['m']) && isset($_GET['d'])) {
|
||||
$usery = $_GET['y'];
|
||||
$userm = $_GET['m'];
|
||||
$userd = $_GET['d'];
|
||||
$IsLeap = 0;
|
||||
if (($usery%4 == 0) && ($usery%100 >0)) $IsLeap =1;
|
||||
if ($usery%400 == 0) $IsLeap = 1;
|
||||
}
|
||||
|
||||
// We need to know the total number of days in the year so far
|
||||
|
||||
$userdays = 0;
|
||||
$i = 0;
|
||||
while ($i < ($userm-1)) {
|
||||
|
||||
$userdays = $userdays + $Anerisia[$i];
|
||||
$i = $i +1;
|
||||
}
|
||||
$userdays = $userdays + $userd;
|
||||
|
||||
// We can now work out the full discordian date for most dates
|
||||
// PHP does not do integer division, so we use 73.2 as a divisor
|
||||
// the value 73.2 works, larger values cause an off-by-one on season
|
||||
// changes for the later seasons .
|
||||
// This is not needed with the mod operator.
|
||||
|
||||
$IsHolyday = 0;
|
||||
$dyear = $usery + 1166;
|
||||
$dmonth = $MONTHS[$userdays/73.2];
|
||||
$dday = $userdays%73;
|
||||
if (0 == $dday) $dday = 73;
|
||||
$Dname = $DAYS[$userdays%5];
|
||||
$Holyday = "St. Tibs Day";
|
||||
if ($dday == 5) {
|
||||
$Holyday = $Holy5[$userdays/73.2];
|
||||
$IsHolyday =1;
|
||||
}
|
||||
if ($dday == 50) {
|
||||
$Holyday = $Holy50[$userdays/73.2];
|
||||
$IsHolyday =1;
|
||||
}
|
||||
|
||||
if (($IsLeap ==1) && ($userd ==29) and ($userm ==2)) $IsHolyday = 2;
|
||||
|
||||
// work out the suffix to the day number
|
||||
$suff = $Dsuff[$dday%10] ;
|
||||
if ((11 <= $dday) && (19 >= $dday)) $suff='th';
|
||||
|
||||
// code to display the date ...
|
||||
|
||||
if ($IsHolyday ==2)
|
||||
echo "</br>Celeberate ",$Holyday," ",$dmonth," YOLD ",$dyear;
|
||||
if ($IsHolyday ==1)
|
||||
echo "</br>Celeberate for today ", $Dname , " The ", $dday,"<sup>",$suff,"</sup>", " day of ", $dmonth , " YOLD " , $dyear , " is the holy day of " , $Holyday;
|
||||
if ($IsHolyday == 0)
|
||||
echo "</br>Today is " , $Dname , " the " , $dday ,"<sup>",$suff, "</sup> day of " , $dmonth , " YOLD " , $dyear;
|
||||
|
||||
?>
|
||||
|
|
|
|||
159
Task/Discordian-date/Pascal/discordian-date.pascal
Normal file
159
Task/Discordian-date/Pascal/discordian-date.pascal
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
program ddate;
|
||||
{
|
||||
This program is free software, it's done it's time
|
||||
and paid for it's crime. You can copy, edit and use this
|
||||
software under the terms of the GNU GPL v3 or later.
|
||||
|
||||
Copyright Pope Englebert Finklestien,
|
||||
On this day Boomtime, the 71st day of Confusion in the YOLD 3183
|
||||
|
||||
This program will print out the current date in Erisian format as specified in
|
||||
|
||||
P R I N C I P I A D I S C O R D I A
|
||||
|
||||
If you run it with a date it the command line in european format (dd mm yy) it
|
||||
will print the equvolent Discordian date. If you omit the year and month the
|
||||
current Anerisiean month and year as assumed.
|
||||
|
||||
|
||||
POPE Englebert Finklestien.
|
||||
}
|
||||
uses Sysutils;
|
||||
|
||||
var
|
||||
YY,MM,DD : word;
|
||||
YOLD : Boolean;
|
||||
Hedgehog: integer;
|
||||
Eris: string;
|
||||
snub: string;
|
||||
chaotica: string;
|
||||
midget: string;
|
||||
bob: string;
|
||||
|
||||
|
||||
Anerisiandaysinmonth: array[1..12] of integer = (31,28,31,30,31,30,31,31,30,31,30,31);
|
||||
|
||||
|
||||
|
||||
procedure anerisiandate;
|
||||
{ tHIS JUST GETS THE DATE INTO THE DD,MM,YY VARIABLES }
|
||||
begin
|
||||
DeCodeDate(date,yy,mm,dd);
|
||||
end;
|
||||
|
||||
procedure BORIS;
|
||||
{ This just tests to see if we are in a leap year }
|
||||
var
|
||||
snafu : boolean;
|
||||
begin
|
||||
snafu := False;
|
||||
if (yy mod 4 = 0) then snafu := True;
|
||||
if ((yy mod 100 = 0) and (yy mod 400 <> 0)) then snafu := False;
|
||||
if ((snafu) and (mm = 2 ) and (dd=29)) then YOLD := True;
|
||||
end;
|
||||
|
||||
function hodgepodge: integer;
|
||||
{ This returns the total number of days since the year began.
|
||||
It doesn't bother with leap years at all.
|
||||
I get a wierd optical illusion looking at the until in this }
|
||||
var
|
||||
fnord : integer;
|
||||
begin
|
||||
Hedgehog := 1;
|
||||
hodgepodge := 0;
|
||||
fnord :=0;
|
||||
if (mm > 1) then repeat
|
||||
fnord := fnord + Anerisiandaysinmonth[Hedgehog];
|
||||
Hedgehog := Hedgehog +1;
|
||||
until Hedgehog = mm;
|
||||
fnord := fnord + dd;
|
||||
hodgepodge := fnord;
|
||||
end;
|
||||
|
||||
|
||||
function treesaregreen(): string;
|
||||
{Returns the YOLD as a string}
|
||||
|
||||
begin
|
||||
treesaregreen := IntTOStr(yy+1166);
|
||||
end;
|
||||
|
||||
|
||||
procedure GRAYFACE;
|
||||
{This calculates everything, but does not bother much about leap years}
|
||||
var
|
||||
wrestle: integer;
|
||||
Thwack: string;
|
||||
begin
|
||||
Hedgehog := hodgepodge;
|
||||
wrestle := 0;
|
||||
Thwack := 'th';
|
||||
{set bob to the name of the holyday or St. Tibs day }
|
||||
bob := 'St. Tibs Day';
|
||||
if (Hedgehog = 5 ) then bob := 'Mungday';
|
||||
if (Hedgehog = 50 ) then bob := 'Chaoflux';
|
||||
if (Hedgehog = 78 ) then bob := 'Mojoday';
|
||||
if (Hedgehog = 123) then bob := 'Discoflux';
|
||||
if (Hedgehog = 151) then bob := 'Syaday';
|
||||
if (Hedgehog = 196) then bob := 'Confuflux';
|
||||
if (Hedgehog = 224) then bob := 'Zaraday';
|
||||
if (Hedgehog = 269) then bob := 'Bureflux';
|
||||
if (Hedgehog = 297) then bob := 'Maladay';
|
||||
if (Hedgehog = 342) then bob := 'Afflux';
|
||||
{Not doing things the usual way
|
||||
Lets find the week day and count the number of
|
||||
5 day weeks all at the same time}
|
||||
while (Hedgehog > 5) do begin
|
||||
Hedgehog := Hedgehog -5;
|
||||
wrestle := Wrestle + 1;
|
||||
end;
|
||||
if (Hedgehog = 1) then snub := 'Sweetmorn' ;
|
||||
if (Hedgehog = 2) then snub := 'BoomTime';
|
||||
if (Hedgehog = 3) then snub := 'Pungenday';
|
||||
if (Hedgehog = 4) then snub := 'Prickle-Prickle';
|
||||
if (Hedgehog = 5) then snub := 'Setting Orange';
|
||||
{Now to set the Season name}
|
||||
chaotica:='The Aftermath';
|
||||
if (wrestle <=57) then chaotica := 'Bureaucracy';
|
||||
if ((wrestle = 58) and (Hedgehog < 3)) then chaotica := 'Bureaucracy';
|
||||
if (wrestle <= 42) then chaotica := 'Confusion';
|
||||
if ((wrestle = 43) and (Hedgehog < 5)) then chaotica := 'Confusion';
|
||||
if (wrestle <=28) then chaotica := 'Discord';
|
||||
if ((wrestle = 29) and (Hedgehog < 2)) then chaotica := 'Discord';
|
||||
if (wrestle <=13) then chaotica := 'Chaos';
|
||||
if ((wrestle = 14) and (Hedgehog < 4)) then chaotica := 'Chaos';
|
||||
|
||||
{Now all we need the day of the season}
|
||||
wrestle := (wrestle*5)+Hedgehog;
|
||||
while (wrestle >73) do wrestle := wrestle -73;
|
||||
{pick the appropriate day postfix, allready set to th}
|
||||
if (wrestle in [1,21,31,41,51,61,71]) then Thwack:='st';
|
||||
if (wrestle in [2,22,32,42,52,62,72]) then Thwack:='nd';
|
||||
if (wrestle in [3,23,33,43,53,63,73]) then Thwack:='rd';
|
||||
{Check to see if it is a holy day, if so bob will have
|
||||
the right holyday name already, including St Tibs Day}
|
||||
if (wrestle in [5,50]) then YOLD := True;
|
||||
{I love this line of code}
|
||||
midget := IntToStr(wrestle) + Thwack;
|
||||
end;
|
||||
|
||||
|
||||
{The main program starts here}
|
||||
begin
|
||||
anerisiandate;
|
||||
if (ParamCount >=1) then dd := StrTOInt(ParamStr(1));
|
||||
if (ParamCount >=2) then mm := StrToInt(ParamStr(2));
|
||||
if (ParamCount =3) then yy := StrToInt(ParamStr(3));
|
||||
BORIS;
|
||||
GRAYFACE;
|
||||
{ The only thing to bother about is holy days and St Tibs day }
|
||||
Eris := 'Today is: ' + snub +' the ' + midget +' day of the season of ' + chaotica;
|
||||
if (YOLD) then begin
|
||||
Eris := 'Celebrate for today, ' + snub + ' the ' + midget + ' day of ' +chaotica + ' is the holy day of ' + bob;
|
||||
end;
|
||||
{The only place we deal with St. Tibs Day}
|
||||
if ((YOLD) and ((mm=2) and (dd=29))) then Eris := 'Celebrate ' + bob + ' Chaos';
|
||||
{This next line applies to all possibilities}
|
||||
Eris := Eris + ' YOLD ' + treesaregreen;
|
||||
WriteLn(Eris);
|
||||
end.
|
||||
21
Task/Discordian-date/Zkl/discordian-date-1.zkl
Normal file
21
Task/Discordian-date/Zkl/discordian-date-1.zkl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
fcn discordianDate(y,m,d){
|
||||
var [const]
|
||||
seasons=T("Chaos","Discord","Confusion","Bureaucracy","The Aftermath"),
|
||||
weekday=T("Sweetmorn","Boomtime","Pungenday","Prickle-Prickle","Setting Orange"),
|
||||
apostle=T("Mungday","Mojoday","Syaday","Zaraday","Maladay"),
|
||||
holiday=T("Chaoflux","Discoflux","Confuflux","Bureflux","Afflux"];
|
||||
|
||||
dYear,isLeapYear := y + 1166, Time.Date.isLeapYear(y);
|
||||
if(isLeapYear and m==2 and d==29)
|
||||
return("St. Tib's Day, in the YOLD " + dYear);
|
||||
|
||||
doy:=Time.Date.nthDayInYear(y,m,d);
|
||||
if(isLeapYear and doy>=60) doy-=1;
|
||||
dsDay:=(if(doy%73==0) 73 else doy%73); // Season day.
|
||||
if(dsDay==5) return(String(apostle[doy/73],", in the YOLD ",dYear));
|
||||
if(dsDay==50) return(String(holiday[doy/73],", in the YOLD ",dYear));
|
||||
|
||||
dSeas:=seasons[(if(doy%73==0) doy-1 else doy)/73];
|
||||
dWday:=weekday[(doy - 1)%5];
|
||||
"%s, day %s of %s in the YOLD %s".fmt(dWday,dsDay,dSeas,dYear);
|
||||
}
|
||||
4
Task/Discordian-date/Zkl/discordian-date-2.zkl
Normal file
4
Task/Discordian-date/Zkl/discordian-date-2.zkl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
foreach y,m,d in (T(T(2010,7,22), T(2012,2,28), T(2012,2,29), T(2012,3,1),
|
||||
T(2010,1, 5), T(2011,5, 3))){
|
||||
"%d-%02d-%02d is -->%s".fmt(y,m,d,discordianDate(y,m,d)).println();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue