# Mahjong Horoscope – How It Works

As of 08.06.21, the "flow check" works by taking the year and the current week (out of 52) and putting them together like YYYYWW. Then, it takes the cosine of that number, then it multiplies it by 100 (100cos(YYYYWW)). After getting a number from that, it rounds it up then sees how "good" it is. The "flow check" is very, very, very simple: if the number is negative, it's bad. If it's positive, it's good. If the number is close to ±100, then it's very good/bad. There's only 4 options for this, very bad, bad, good, and very good. I'll change this later, but this simple approach is there just so that there's anything at all here.

Example: Week 24 of 2021.
The YYYYWW number for this week is 202124. So, following the process, we take the cosine of 202124—cos(202124) = 0.977642888196. Okay, now let's multiply that by 100: 97.7642888196. That's pretty ugly, so lets round up to 98 (note: this always rounds up, even if the number is like 97.2...). Again, the check is extremely simple, so it just looks how close the number is to ±100. 98 is pretty dang close to 100, if you ask me, so this would be very good. If you were to look at the home page on the 24th week of 2021, it would say "Good" and have a picture of someone doing some crazy wall tricks.

# Plans for a future version

I plan on making the site give a bit more options for a user's flow (rather than just 4 lmao) and have it be a bit more sporadic. Due to a cosine's periodic oscillation, the flow will always go from bad to good to bad again. I concidered changing that week ID number to have the year on the end so that when the week changed, the number changed by 10,000, which would make the cosine function change drastically from week to week, but I've decided to go with a much more sophisticated pseudorandom function tied to the flow. After I'm done making the "draw a tile" and haipai generator, I'll look into this a bit more.

# August 2021 Update

After 2 million years (2 months), I've decided on a prng to work with. It's kinda funky, but it works. I'm using the number of times you have to run an integer through the Callatz problem to reach 1.
What's the Callatz problem? Glad you asked. It's also known as the 3X+1 problem. Basically, you take any positive integer and cycle it through this:

• If the integer is even, divide it by 2
• If the integer is odd, multiply it by 3, then add 1
• If the integer is 1, stop. (It will go back to 4 then be stuck in a loop of 4 -> 2 -> 1 -> 4 otherwise)
• Repeat

Veritasium made a video on this, and in that video, he said that it could be used as a psuedorandom number generator. When I wrote what's above this, what with the "sphisticated psuedorandom function" and all, I was planning on using a concept from this Vertiasum video, but didn't because I wanted to do stuff with my personal site, like make it. Now that I'm done completely neglecting MJ Horoscope, I'm now going to use a system based on the week ID (see above) and how long it takes that number to reach 1 in the Collatz problem. For example, this week (322021—I changed how the week ID system works, too) takes 122 repeats to get to 1. Next week (332021) only takes 91 iterations to get to 1. Now, as I right this, I don't really have a way to use this information. I'm thinking it'll be—like—the further the number is from 0, the worse flow that week has...? The logic being that the number isn't too friendly, it takes a long time to settle down to the 4,2,1 loop. Kinda like how musical intervals with "nicer" ratios sound "nicer", like an octave's 2:1 or a perfect fifth's 3:2 vs. a tritone's 64:45 (🤢🤮). If it's not clear, as I right this section, there actually isn't anything in place to show the new flow functions, the home page is just "Decent." I'll (probably) change this paragraph later when I properly implement it.