Mayan long count

This is what my teacher posted.. .and I HAVE NO CLUE on how to even start it!
1 Kin is 1 Day
1 Uinal is 20 Kin
1 Tun is 18 Uinal
1 Katun is 20 Tun
1 Baktun is 20 Katun
All numbers start at 0 and increment to their cycle end and then repeat. Backtuns turn over after 19.
The Long Count is written as Baktun.Katun.Tun.Uinal.Kin

The first phase of the assignment, your code should display the following [as typed below]
[1] Days To Mayan Long Count [2] Mayan Long Count To Days [3] Mayan Calendar Restructured
For input 1 - If I give you some integer number of days, I want to see the Mayan Long Count. For 2, if I give you a Mayan Long Count I want to know how many days have passed, and for 3, I want to put in any Long Count and you should format it as a valid Long Count [ie - if I put in then you should give me First, I want the complete solution in pseudo code then make a working program using Visual basic studio 2010.
collegegrad012 wrote:
I HAVE NO CLUE on how to even start it!
collegegrad012s teacher wrote:
First, I want the complete solution in pseudo code
What is causing to you have trouble starting? What are you confused about? We'd be happy to explain.
Last edited on
Best way to handle this is with a series of ints and when you output, you are going to want to output each value, followed by a "." until you get to the Kin stage. Here's a list of the different values set as constant ints represented in days:

const int kin = 1; //1 kin = 1 day
const int uinal = 20; //1 uinal = 20 days
const int tun = 360; //1 tun = 360 days
const int katun = 7200; //1 katun = 7,200 days
const int baktun = 144000; //1 baktun = 144,000 days 

Let's say that you have 500,000 days. You need to start doing modulus math (starting with the largest unit, baktun, and working your way down to kin) and figure out how many units of each you have.

500000 / 144000 = 3
500000 % 144000 = 68000

So now you know you have 3 Baktun with a remainder of 68000 days. Keep working it down until you have each value, then you can print it out like this:

std::cout << numBaktun << "." << numKatun << "." << numTun << "." << numUinal << "." << numKin << '\n';

Hope that gives you a push in the right direction.
Alright, Here's a way to start;

you know that 1 kin is a day, so 20 kin is 20 days which is 1 Uinal. and 18 Uinal is really 18 x 20 days. So continue with that conversion until you have everything in regular years, months and dates.

That's your first thing to do.

Edit: randisking beat me to it :p
Last edited on
Do you understand how to convert seconds to HH:MM:SS? This assignment works the same way.
Topic archived. No new replies allowed.