Wednesday, June 6, 2012

More Long Count Calendar Updates

I've been making some awesome progress on the long count calendar application. I've got all of the math working (although I still need to test all of the nasty edge cases to make sure it calculates things correctly), but for anything after 1582 (when the Gregorian calendar came about) it seems to be working just fine. To test the date calculations I'm working on the ability to convert ANY date into a long count. This is a nice feature to have (what was Jan 1, 1900, for instance?) and will be useful for people looking to compare against other date calculations. The other thing I'm going to provide is the ability to put in a long count date (13.17.5.2.1) and see what date that converts to in a Gregorian calendar.
Normally, the main issue about converting from these earlier dates to later ones is that not everyone transitioned to the Gregorian calendar at the same time.Most of Catholic Europe adopted it in/around 1582. The British empire didn't adopt it until 1752 and the Soviet Union was in 1918 (right after the Bolsheviks took power and Russia became the Soviet Union). The Wikipedia article on the calendar has a nice chart showing the adoption times for different countries. So depending on where you were you had a different calendar. I'm pretty sure that the date is the 1582 and using the default NSCalendar objects will fix it for that date, I believe.
I will say that Apple seems to have done a good job with the calendar objects. NSCalendar and NSCalendarComponents are very nice little objects that really do simplify the mathematics. I have to convert to Julian dating anyway, which makes the math about as easy as it can be, but having the system provide some of the common functionality is very handy, especially being able to extract out year, month, and day without any extra divs and mods on my part. It will even provide the day of the week if you need it (which I don't in this particular application). I still need to dig into the objects a little more, especially with the pre-1582 dating - just to make sure they work as expected.
I did get the T'zolkin and Haab calculations into the application, so not only does it show the long count form (12.19.19.8.2 for today) but also the "month" and "day" (5 Sotz' 1 Ok - also for today). So everything is present in the application now from an implementation perspective - all the math works, it grabs the right images, etc. I need to get some better quality glyphs for the application, though, because the ones I have are low-res and won't look good on the iPhone let alone an iPad. That could actually be a major pain in the butt - one I'm not concerned about right now (those two stories are last on my kanban board), but I recognize that I'm going to have to spend some time either finding some good quality ones or drawing them myself (shudder!).
Overall things are looking really good. I think I might be able to make some good progress this weekend during downtime for Yeomen of the Guard. I'm off-stage quite a bit and with 3 shows in 4 days, I've got a lot of potential time to move this forward. I'm setting a goal of having the Gregorian to Long Count conversion done around Saturday night, the Long Count to Gregorian conversion around Sunday afternoon, and the reckonings done by Monday night. Which means that all I'll have left to do is get some good graphics next week and then I could, in theory, put it out on the App Store by the end of June - the first such Otto Von product to be available. All in the course of 3 weeks. Wow.
So keep your fingers crossed - I need all the luck I can get on this rapid development path!

Monday, June 4, 2012

Silly Little Mayan Long Count Calendar Utility

So for post 101 (that's 5 in binary), I'm giving a sneak peek into a silly utility I decided to develop. I don't know why, but it's just been one of those things that I thought "you know - why not?". So I am. And what IS said utility? Oh, it's tres bien, mon amie. And tres sillie. (And yes, I know that sillie is not really French). Regardless, here's a screenshot:
And what, pray tell, is that? Why, my friends, that's a Long Count (commonly referred to as "Mayan") calendar converter. It tells you what day it is in the Long Count (which, ya know, 'ends' on Dec 21 of this year - but not really). The Long Count calendar is actually pretty straightforward. It's mostly based on the number of days since the "dawn of man" which is 13.0.0.0.0 - a date that correlates commonly to August 11, 3114 B.C.E. It uses a Julian dating scheme (every day is just 1 more day) and then divs and mods them into buckets (b'ak'tun, k'atun, tun, winal, and k'in). The main Wiki page gives a pretty good explanation of the whole thing.
I pretty much started it this evening when I got home, but I've been reading about the Long Count for a while now. I'm intrigued by different counting methods. I used to have a devil of a time with them (converting from decimal to binary to hexadecimal sucked). And then I heard Tom Lehrer's "New Math" (YouTube link here - and yes, you want to click it) and it completely resonated. I grokked it. My mom had Lehrer's LPs (if you remember those, you're older than you look) and I listened to them endlessly. Since then I've kind of geeked out at new methodologies.
Anyway, I looked in the App Store and saw a couple of things about the Long Count calendar but saw that some people were disappointed in the lack of functionality of some of those other apps. There are multiple "reckonings" for the start point of the Long Count, but those are all just relative to the main reckoning. It seems simplistic to use the different reckonings for reference use and also to allow people to convert any date. Probably be able to put in a Long Count and have it convert to a Gregorian date as well. So I'll see what I can do to make that happen and quickly.
Given that I have the basic calendar already working in just a few hours I'm actually feeling a lot more accomplished than I have in ages. And that's a good thing. And tres bien, mon amie.