HUGI SIZE CODING COMPETITION 20
The Easter-date Compo
Welcome to the Hugi Size Coding Compo #20! After the HC19 graphical
task the votes have declared that the challenge should be a shortest
way to compute the date of Easter from a given year using the
Gregorian Calendar. To make the program more useful, the input will
come from standard input (i.e. the keyboard or a redirected file).
The rules
Your entry should input any number of lines from standard input. Each
line will only contain 4 decimal digits ('0'-'9') representing a year
followed by <CR>(=0dh). The <CR> may or may not be followed by a <LF>.
After a line has been read from STDIN your program should add a dash
'-' after the year and calculate the date of Easter from the year that
was just read from STDIN. It should then output the date of Easter to
STDOUT using the months name, either March or April, followed by a space,
followed by the day of the month, all on the same line as the year.
The day of the month is a decimal value between 1 and 31. If dd<10, the
leading zero should be converted to a space. (dd is right aligned).
Each output line must end with a <CR><LF> pair and may NOT contain any
characters between the day value and the <CR><LF> pair. Your entry must
exit cleanly to DOS if the first char on the input line is <EOF>(=1ah),
it should exit directly after encountering and outputting the <EOF>.
If the output is redirected, the destination file must exactly match
what would have been output to the screen if the output hadn't been
redirected. If only the output is redirected, the characters typed at
the keyboard must be redirected to the output file instead of the screen.
Note that since we want to make this tool at least a little useful, your
entry should reply with a result after 1 line is read!! You may not read
another line without first displaying the correct output for the given line.
(We want to be able to use the keyboard).
Oudin's Algo
Here is an example algorithm for calculating the date of Easter from
Oudin 1940. (Thank god for cut n paste)
C = Y / 100
N = Y - 19 * ( Y / 19 )
K = ( C - 17 ) / 25
I = C - C / 4 - ( C - K ) / 3 + 19 * N + 15
I = I - 30 * ( I / 30 )
I = I - ( I / 28 ) * ( 1 - ( I / 28 ) * ( 29 / ( I + 1 ) )
* ( ( 21 - N ) / 11 ) )
J = Y + Y / 4 + I + 2 - C + C / 4
J = J - 7 * ( J / 7 )
L = I - J
M = 3 + ( L + 40 ) / 44
D = L + 28 - 31 * ( M / 4 )
Where Y is the year read from STDIN, M is the month number (3 = March)
and D is the day of the month. All variables used are integers and the
result of all divisions are rounded down to the nearest integer. What
ever algorithm you use, your result must match the outcome of the above
calculation between and including the years 1583 and 4099.
For example, using the year 2010,
Y=2010,
C=2010/100=20,
N=2010 - 19 X (2010/19) = 15,
etc. resulting in Easter on April 4, 2010.
So an input line: 2010<CR>[<LF]>]
must output: April 4
The screen will reflect:
2010-April 4<CR><LF>
Assumptions
All the rules stated in General.txt should be obeyed.
You may assume that any line exists of either dddd<CR>[<LF>] or
<EOF><CR>[<LF>]
where d is a decimal char '0' to '9'. You may also assume that
dddd has a value between 1582 and 4100 (but not including). If
the value of the year is not within the boundaries or any other
false input is encountered your entry may do what ever you want
it to do (even crash).
You may not assume that a <CR> is followed by <LF>, your entry
should handle both cases correctly. Also you may not assume that
the input is redirected (that means either direct keyboard input
and redirection from file must work)
Test suite
A test suite and an example will come with the rules. Your entry
should always pass the test suite BUT even if the entry passes
the test suite, there may still be hidden flaws or bad assumptions
which may be judged after the compo is over.
Some interesting sites
http://aa.usno.navy.mil/faq/docs/easter.html
http://users.chariot.net.au/~gmarts/eastalg.htm
Schedule
--------
Compo starts: Fri, Nov 1, 2002 (00:00:00)
Deadline for entry submission: Sat, Dec 14, 2002 (23:59:59)
Entries and beta results released: Sun, Dec 15, 2002 (when I wake up :)
Start of Public Judgement: Sun, Dec 15, 2002 (shortly after)
End of Public Judgement: Thu, Dec 19, 2002 (23:59:59)
Final results released: Fri, Dec 20, 2002 (promptly)
Good luck!
Ruud
Contributions to the rules by:
(Thanks Ruud), Dimitri Smits, Paolo, Jeff and Sniper
HC20 results:
1. Ruud The Netherlands 125 13 Nov 2002
2. Sergo Polsky Russia 130 12 Dec 2002
meph Germany 130 15 Dec 2002
4. Aphex Romania 131 9 Dec 2002
5. Jeff United States 137 26 Nov 2002
espineter Spain 137 9 Dec 2002
7. ATV Finland 139 9 Dec 2002
8. Houssem Bdioui Tunisia 143 15 Dec 2002
9. Tabchouri (ghazi) Tunisia 145 16 Dec 2002
10. Boiled Brain Belarus 146 5 Nov 2002
Beeblebrox Ukraine 146 22 Nov 2002
12. Sniper United States 153 9 Dec 2002
13. Gongo Belgium 167 13 Nov 2002