Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -16,39 +16,43 @@ public class DiscordianDate {
"Bureflux", "Afflux"};
public static String discordianDate(final GregorianCalendar date) {
int y = date.get(Calendar.YEAR) + 1166;
int m = date.get(Calendar.MONTH);
int d = date.get(Calendar.DATE);
if (date.isLeapYear(y) && m == 2 && d == 29)
return "St. Tib's Day, in the YOLD " + y;
int y = date.get(Calendar.YEAR);
int yold = y + 1166;
int dayOfYear = date.get(Calendar.DAY_OF_YEAR);
if (date.isLeapYear(y) && dayOfYear >= 60)
dayOfYear--;
int seasonDay = dayOfYear % 73;
if (date.isLeapYear(y)) {
if (dayOfYear == 60)
return "St. Tib's Day, in the YOLD " + yold;
else if (dayOfYear > 60)
dayOfYear--;
}
dayOfYear--;
int seasonDay = dayOfYear % 73 + 1;
if (seasonDay == 5)
return apostle[dayOfYear / 73] + ", in the YOLD " + y;
return apostle[dayOfYear / 73] + ", in the YOLD " + yold;
if (seasonDay == 50)
return holiday[dayOfYear / 73] + ", in the YOLD " + y;
return holiday[dayOfYear / 73] + ", in the YOLD " + yold;
String season = seasons[dayOfYear / 73];
String dayOfWeek = weekday[(dayOfYear - 1) % 5];
String dayOfWeek = weekday[dayOfYear % 5];
return String.format("%s, day %s of %s in the YOLD %s",
dayOfWeek, seasonDay, season, y);
dayOfWeek, seasonDay, season, yold);
}
public static void main(String[] args) {
System.out.println(discordianDate(new GregorianCalendar()));
test(2010, 7, 22, "Pungenday, day 57 of Confusion in the YOLD 3176");
test(2012, 2, 28, "Prickle-Prickle, day 59 of Chaos in the YOLD 3178");
test(2012, 2, 29, "St. Tib's Day, in the YOLD 3178");
test(2012, 3, 1, "Setting Orange, day 60 of Chaos in the YOLD 3178");
test(2010, 1, 5, "Mungday, in the YOLD 3176");
test(2011, 5, 3, "Discoflux, in the YOLD 3177");
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");
}
private static void test(int y, int m, int d, final String result) {