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!