Divination Calendar/I-Ching Program

I'm going to say a bunch about what I am doing just in case maybe there is something easier I am only missing, but the point I am at is going into code.

I have a I-Ching/Mayan(Tzolkin) calendar where every day the entire setup of the calendar changes so that today is as if the first day of 260 day's and tomorrow is as the first and so on. This is important because the Tzolkin is made up of 260(13X20) days and each day has specific meaning. As well I need to randomly pick 1-64(the I-Ching), add the two together and get a specific 4 of 260(65 minus the middle so 64 x 4) to place on the I-Ching meanings.

Where I am right now

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
using namespace std;

main ()
{
	for(int c=0;c<65;)
	{
		if (a<10,b<17)
		{
			for(a,b;a<10,b<17;a+=4,b+=4)
			{
				c++;
				return a, b;//so the current date is being added to
			}
		}
		else
		{
			c++;
			return a+=4-13, b+=4-20;
		}
		cout << c=1 << c=17 << c=33 << c=49;//I know this doesn't work
	}
}


What I want to do is take the Tzolkin date, continuously add 4 to the Tones(1-13) and Signs(1-20) till it reaches 65 different Tone Sign combinations, once I have them all I only want to take the count number or c and work with the numbers that get calculated as return values along with c when it reaches as written 1/17/33/49. Something like return a, b when c=x for every instance of a, b when c = 1-65

just started heavy crunching for about a week now, hehe, screw visual studio (community at least), it couldn't even compile a set of more than 128 if statements.

Just imagine the time is included in previous code and split up so that there is a functional tzolkin calendar, I don't feel like including everything, only what Im missing. So a, and b are integers that are derived from the calendar ie a = 1-13, and b = 1-20.
Last edited on
Sorry, but I did not understand a single thing in your explanation.
The Wikipedia article on the tzolk'in (https://en.wikipedia.org/wiki/Tzolk%CA%BCin ) is also poorly explained, but from what I understand, the "first" day is 1 imix, then 2 ik', ..., 13 b'en, 1 ix, ..., 7 ajaw, 8 imix, ..., 12 kawah, 13 ajaw, 1 imix, and so on. You want to somehow combine this nonsense with the I-Ching nonsense, but I'm really unclear on the how. Could you clarify that?

it couldn't even compile a set of more than 128 if statements.
No code ever, ever needs so many if statements.
Well,

L4 main() should be defined as int main()

L8 a and b haven't been defined. The , probably doesn't do what you want. In this case the a<10 is evaluated and the result discarded. The if statement condition is just b <17. Do you mean if (a < 10 && b < 17) ??

Similar for L10

L13, L19. You can only return 1 value. L13 returns b and L19 evaluates a+=4-13 (why not just a-= 9 ??), evaluates b+= 4-20 (why not b-= 16 ??) and returns the value of b.

L21. That is invalid syntax. You need () around c=1 etc to compile.



pretty much all I am wanting to do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
using namespace std;

int Tone(int a, int b)
{
	for(int c=1;c=b;a+=4)//c is used for count
	{
		if(c!=b)
		{
			c++;
			return a;
		}
		else
		{
			c++;
			a = a % 13;
			return a;
		}
	}
}
int Lens(int a, int b)
{
	for(int c=1;c=b;a+=4)//c is used for count
	{
		if (c!=b)
		{
			c++;
			return a;
		}
		else
		{
			a = a % 20;
			return a;
		}
	}
}
int main ()
{
	int t = Tone(3, 19);
	int s = Lens(20, 19);
	cout << t << ", " << s;
}


so...3, 20 "or 3 akbal on wikipedia" is what Im trying to find. I can do all of this on paper I just cant figure it out in code.

What 3, 20 should be returning me is 10, 12. I need to somehow get it to return me that.

the for(){if(){}} statements, to me, should be adding 4 to the a number till c(or the count) reaches b. once there I only need to figure out a % 13 where 0 = 13, and a % 20 where once again 0 is then converted to 20. if I can get this, I have the code to put to the rest of the program easy. all I need is for 3, 20 with a I-Ching reading of 19(ie the above code) to return me a number where 3, 20 is now the begining of the calendar, and 19 is the 4(10, 12+11,13+12,14+13,15) signs that make the I-Ching(19 or thunder over thunder) fit.

my thoughts are this now.

@ seeplus: thanks alot, that previous post was a little messy, I knew it didn't compile, I only wish to return designated a & b values when c = set (with b) value
I read your post, so sorry if ((c=12) or whatever) solves my problem, but this is where I am right now, and aside from small "i didn't care about anything else" mistakes...Im pretty sure I can work out the while/for/if statements if I can work out the a, b if c type statement.

@helios if 128 if statements can be done much easier than they should at least tell me how, and not tell me I only cant do it if some other program does it. a personal mayan calendar isn't too much to ask for, how can I work on building a video game possibly if I cant even do something I can do on paper? a 30gb program not working to a <500mb one working is too much to me.
Last edited on
Sorry, but your revised code is nonsensical.

The Tone() function...

The for loop on L6

c is defined as an int with an initoal value of 1.

c is then set to the value of b. If the result of this assignment is zero, then the loop is terminated otherwise L7-18 are executed.

L8. This will always be false as c has just been assigned the value of b - hence L14-16 are executed. a is calculated as a%13 and this value of a is returned and the function exited.

This always happens unless b is 0. If b is 0 then the function is ill-formed as there is then no value returned!
Last edited on
booya you bad mofo, you got it, haha...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
using namespace std;

int Tone(int a, int b)
{
	int c = 1;
	while(c!=b)
	{
		c++;
		a+=4;
	}
	return a % 13;
}
int Lens(int a, int b)
{
	int c = 1;
	while(c!=b)
	{
		c++;
		a+=4;
	}
	return a % 20;
}
int main ()
{
	int t = Tone(3, 19);
	int s = Lens(20, 19);
	cout << t << ", " << s;
}


10, 12


edit: sorry, a previous wrong copy of the code
Last edited on
Note that your functions can be simplified.
1
2
3
4
5
6
7
int Tone(int a, int b){
    return (a + 4 * (b - 1)) % 13;
}

int Lens(int a, int b){
    return (a + 4 * (b - 1)) % 20;
}
Jeeze, I was so excited I thought of a way to do it, I didn't see it was as easy as straight algebra. While, for haha. Duh now...too much programming, not enough practicality.
Topic archived. No new replies allowed.