Human Calendar Calculation 7.97 Easy mode and 9.92 Hard mode

kinch2002

Premium Member
Joined
Dec 22, 2008
Messages
2,504
Location
Guildford! UK!
WCA ID
2009SHEP01
YouTube
Visit Channel
Last edited by a moderator:
Came here to ask what method, saw it was already in the description. Thanks :p

I've just learned to do this and I do it by adding (using these tables):
month value+date+century value+(last two digits of year mod28)+(last two digits of year/4, rounded down)
Then mod7 ing it, and finally using the day of the week table.

Do you know whether this is a good method or not? It's easy to learn...
Also where can I download that spreadsheet?

E: Don't think I need the spreadsheet any more: I wrote my own program. This is the first time something from computing has actually come in useful outside of college...
E2: (previous versions of my program)
lHylrBD.png

99 lines... not great :p
http://pastebin.com/CH6E7qHW
I've only been doing programming stuff since September, so I'm happy with this, even if it could probably be half the length.
also brb learning how to use the time thing

E3: Now including a timer!
PBBWc6M.png

105 lines... even less great. But it works.
pastebin
(if someone else wants to use mine but doesn't want to type out the full day name change the strings in lines 58-64, because they are what your input is compared to)
(you can change the range of years on line 27)

E4: bug fix + shorter inputs: pastebin
If you want to change...
range of years: line 26, lines 48-51
what you input: lines 66-72

E5: I think I'll call this finished, unless I have some other idea. This is all I want for now. Pastebin.
E6: bug fix
 
Last edited:
Came here to ask what method, saw it was already in the description. Thanks :p

I've just learned to do this and I do it by adding (using these tables):
month value+date+century value+(last two digits of year mod28)+(last two digits of year/4, rounded down)
Then mod7 ing it, and finally using the day of the week table.

Do you know whether this is a good method or not? It's easy to learn...
Yeah that's pretty much the same method I learnt first. Although taking mod 28 of the year is totally pointless if you're going to mod 7 later. I just did mod 7 of the year then added the leap year stuff.
Now I use:
Day + MonthLookup + YearLookup + CenturyCode
My first step is to see the Day and Month and immediately have a number between 0 and 6 in my head (it's kind of adding them, but I can usually skip the actual addition and just "see" the number)
Then I add the YearLookup. I know all of these from 00 to 99 in a split second. So I see 43=4, 91=1,37=4 etc. without hesitation.
Then the century code is basically an afterthought to finish it off.
 
Showoff ;) I don't really know much python, but you doing that in a fifth of the lines (maybe a quarter if you take out comments from mine) really makes me want to learn more of it.

Well you can probably do much better in Pascal as well. But yeah, I don't get tired using and advocating Python.
 
Back
Top