posted 19 years ago
Your assignment, should you choose to accept it, is to come up with the Day Of The Week calculation that is easiest to perform mentally. The algorithm has to work for for any date from Jan 1, 1900 to Dec 31, 2099. (Two centuries ought to be enough.) The final result of the calculation must come out so that a 0 represents Sunday, 1 Monday, ... 6 Saturday.
The exact fitness calulation will be this:
As you can see allowance was made for the fact that x mod 4 is easier to calculate in your head than x mod 7.
Let's see an example algorithm/calculation (March 2, 2005)
Can I cut down that 24 points for 12 constants? Hmmm... 5, 1, 1, 4, 6, 2, 4, 0, 3, 5, 1, 3. I don't see anything.
Surely, there is an algorithm that scores fewer than 42 points (and still comes out with the right answer).
Ryan
[ March 02, 2005: Message edited by: Ryan McGuire ]