Difference between revisions of "Eth0:2008 Summer/Python Game"
From Eth0Wiki
Line 132: | Line 132: | ||
<b>You will have until Friday 10:42:23 CEST to send in your contributions for this challenge.</b> | <b>You will have until Friday 10:42:23 CEST to send in your contributions for this challenge.</b> | ||
+ | [[Image:Carryall.jpg|right]] | ||
* http://tehmaze.com/games/eth0-pygolf/game02.py | * http://tehmaze.com/games/eth0-pygolf/game02.py | ||
* http://tehmaze.com/games/eth0-pygolf/game02_test.py | * http://tehmaze.com/games/eth0-pygolf/game02_test.py | ||
− | |||
Farmer Duke's crops are at stake, something horrible has happened / is happening and he needs *your* help. | Farmer Duke's crops are at stake, something horrible has happened / is happening and he needs *your* help. | ||
The goal is to find the most dense 5x5 area in a given field. Farmer Duke needs the center coordinate for this area so he can call in the carryall. | The goal is to find the most dense 5x5 area in a given field. Farmer Duke needs the center coordinate for this area so he can call in the carryall. |
Revision as of 22:44, 9 July 2008
The Python Golf game.
Contents
Rules
The rules are quite straight-forward, they are as follows:
- Every level is a working example of a problem
- You have to make the shortest version (least amount of code-bytes)
- Comments are ignored (for the points)
- Whitespace characters are ignored (for the points)
- lambda/map/reduce functions are allowed
- Cheating is not allowed (writing the code in comment, and later eval(), etc.)
- The code must generate exactly the same output as the example for the given input
- Your code will be passed through a validator
- All contributions must use the Python default library ONLY!
How to earn points:
- The first contribution earns 5 points
- Every contribution that has less characters, earns the difference of characters in points * 2, with a maximum of 10 points
- Every following contribution will remove one point from your score (every stroke)
How to win:
- Collect the most points :)
- Write short code
- Keep the code to yourself
Participation
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 games-eth0XX@XXtehmaze.com (remove both XX)
All challenges will be available from http://10.42.122.52/~maze/
You can just modify gameXX.py, and start hacking from there (backup the original challenge!)
An example run may look like:
$ python game01_test.py checking number 6011000990139424: valid, good checking number 378282246310005: valid, good checking number 378734493671000: valid, good checking number 371449635398442: invalid, good checking number 7868936092868819: invalid, good checking number 30569309025904: valid, good checking number 4005550000000019: valid, good checking number 4005550000000020: invalid, good checking number 49927398716: valid, good checking number 371449635398431: valid, good checking number 6011111111111117: valid, good checking number 3566002020360505: valid, good checking number 2774118266696359: invalid, good checking number 2465713360208684: invalid, good checking number 3530111333300000: valid, good checking number 38520000023237: valid, good your script seems to be functioning correctly your script size is 301 bytes
Getting help
There will be tutoring via IRC, if I have the time. Please join us on irc://irc.eth-0.nl/eth0 or use the web based chat.
Challenges
You need the game test framework from:
Game 1: The eleven-check
You will have until Wednesday 23:59:59 CEST to send in your contributions for this challenge.
The creditcard validation algorithm. Most credit card numbers are encoded with a "Check Digit". A check digit is a digit added to a number (either at the end or the beginning) that validates the authenticity of the number. A simple algorithm is applied to the other digits of the number which yields the check digit. By running the algorithm, and comparing the check digit you get from the algorithm with the check digit encoded with the credit card number, you can verify that you have correctly read all of the digits and that they make a valid combination. We're going to use the LUHN Formula to check the credit card number's validity Step 1: Double the value of alternate digits of the primary account number beginning with the second digit from the right (the first right-hand digit is the check digit.) Step 2: Add the individual digits comprising the products obtained in Step 1 to each of the unaffected digits in the original number. Step 3: The total obtained in Step 2 must be a number ending in zero (30, 40, 50, etc.) for the account number to be validated. For example, to validate the primary account number 49927398716: Step 1: 4 9 9 2 7 3 9 8 7 1 6 x2 x2 x2 x2 x2 -------------------------------- 18 4 6 16 2 Step 2: 4 +(1+8)+ 9 + (4) + 7 + (6) + 9 +(1+6) + 7 + (2) + 6 Step 3: Sum = 70 : Card number is validated Note: Card is valid because the 70/10 yields no remainder.
Scores
User | Size | Points | Date |
VeXocide | 88 | 5+1+1 | 2008-07-09 13:12 |
Floes | 89 | 10 | 2008-07-09 14:43 |
Game 2: Field optimization
You will have until Friday 10:42:23 CEST to send in your contributions for this challenge.
Farmer Duke's crops are at stake, something horrible has happened / is happening and he needs *your* help. The goal is to find the most dense 5x5 area in a given field. Farmer Duke needs the center coordinate for this area so he can call in the carryall.
Prize
The winner of this contest will receive a CoolerMaster RealPower m700 (modular 700 watt atx psu)
Anyone who mails their result to tehmaze whilst being at eth0 is allowed to participate, the winning entry is selected by tehmaze.