scvsoft / challenge-accepted

Juego que presentamos en la Rubyconf 2013
http://scvsoft.com/challenge-accepted
0 stars 0 forks source link

Propuesta Ejercicio - Mayan Calendar #47

Closed tepen closed 10 years ago

tepen commented 10 years ago

[MEDIUM] Mayan long count - convert a date from the Gregorian calender to the Mayan Calendar.

A line should be input that contains a day, a month, and a year (in that order) separated by a single space. The output should be in the pattern ..... Remember to handler leap years! (To make it simpler, though, you can write it to only accept dates since 1 January 1970.

Explanation of the Mayan calendar: The Maya name for a day was k'in. Twenty of these k'ins are known as a winal or uinal. Eighteen winals make one tun. Twenty tuns are known as a k'atun. Twenty k'atuns make a b'ak'tun.. Essentially, we have this pattern: 1 kin = 1 day 1 uinal = 20 kin 1 tun = 18 uinal 1 katun = 20 tun 1 baktun = 20 katun

The long count date format follows the number of each type, from longest-to-shortest time measurement, separated by dots. As an example, '12.17.16.7.5' means 12 baktun, 17 katun, 16 tun, 7 uinal, and 5 kin. This is also the date that corresponds to January 1st, 1970. Another example would be December 21st, 2012: '13.0.0.0.0'. This date is completely valid, though shown here as an example of a "roll-over" date. Example input: 20 7 1988 Example output: 12.18.15.4.0

leoasis commented 10 years ago

This one seems fairly easy as well. I think it's either this one or the Roman Numbers

tepen commented 10 years ago

Played with this one for a bit, I can't figure out what it is they are using as the zero date. if 2012, 12, 21 is 13 baktun

leoasis commented 10 years ago

Can't you figure out from this: " As an example, '12.17.16.7.5' means 12 baktun, 17 katun, 16 tun, 7 uinal, and 5 kin. This is also the date that corresponds to January 1st, 1970. "?

leoasis commented 10 years ago

Also, why do you need the zero?

tepen commented 10 years ago

Ah! didn't see the date for epoch! that makes a difference!