Eth1-Winter Python Game
From Eth0Wiki
Rules
The rules are quite straight-forward, they are as follows:
- The competition is won by the submission with the highest score
- Your code will produce valid results (a testing tool is provided)
- Your code will run with Python2.5
- Your code will use the Python default library ONLY!
- Cheating is not allowed (writing the code in comment and later eval(), etc).
- Whether code is 'cheating' is decided by the issuer of this competition (reasons will be provided).
- You can submit as often as you like
Scoring
- Every character counts for a single point
- Whitespace used for indent (and trailing whitespace) is ignored
- Newlines count for a single point
- Comments are ignored (for the score)
- Your score is 72500 divided by the amount of points you scored.
How to win
- Learn Python
- Write short code
- Learn more Python
- Write the shortest code
- Keep the code to yourself
- Do share ideas and knowledge, this is good behaviour
Submission
You can send in your contributions, by the following channels:
- Paste your code in a PRIVATE paste on http://qna.nu, http://paste-it.net, or whatever, give me the URL.
- Mail your code to elmer.delooffXXX@XXXgmail.com (remove both XXX)
- Your module should be named "areamax.py", the main function should be named AreaMax (the testing file already ensures this though)
Prizes will be awarded for the highest scoring submissions / most entertaining submissions. There's ten small prizes available for participators.
Getting help
There will be tutoring available via either IRC (irc://irc.eth-0.nl/eth0) or just hanging out together :)
Challenge
Relevant files:
You will be given a square of 15x15 (random) integers in the range 10 to 99 (inclusive). This will be a single string with spaces to separate the columns and linebreaks to separate lines.
Write a function that returns a tuple of the score of the square that yields the highest score and its x, y coordinate. The most bottom left coordinate (on the string) is 1,1, the most bottom right coordinate is 15,1 The score is the combined value of all *surrounding* squares:
- Even numbers count positive
- Odd numbers count negative.
In this example, the x marks the coordinate we're calculating the value for:
4 5 1 3 x 2 8 6 1
The score is: (4 + 2 + 8 + 6) - (5 + 1 + 3 + 1) = 10
Good luck :)
Aftermath
So I forgot to announce a proper closing time of the competition (I thought I had announced it as 18:00 on the sunday, but apparently I hadn't..). As such, the entries have remained open until yesterday (2009-01-30 -- yes, completely arbitrary).
The only entry I had received before the (poorly announced) entry window on the LAN closed was from Stitch, who as such is the de-facto winner! However, not to be unfair to the other competitors (and since everyone gets the same prize anyhow), here are the entries as I received them, in no particular order:
- Stitch's entry (2550 characters)
- VeXocide's entry (238 characters)
- Whizzrd's entry (543 characters)
Prizes
Unfortunately I was unable to acquire a set of shinies, but there are stickers available to spruce up your laptop (or the refridgerator of course) :)