20
3
What I'd like to see is your attempts at writing a kind of "story" that has a fairly easy to read meaning, but also creating a valid code fragment. For example, this (BBC) BASIC code:
LET customer = "sober"
REPEAT
INPUT "more beer"
UNTIL customer = "drunk"
(based on http://img.rakuten.com/PIC/12184048/0/1/300/12184048.jpg for the idea)
Rules/guidelines:
- The code must be valid in the language you specified - Anybody must be able to run it without needing to create any fancy
- Strings, comments, or anything that allows free text to be added to the code, may be used, but for at most 3 words per string (and you can't put multiple strings or comments in a row)
- Your code does not have to result in any sensible output when it's executed. It can even be an infinite loop, as long as the code is valid and it represents something sensible(*) when read in English.
- Any interpunction in your code will be ignored in the story.
- Variables do not need to be defined. The code you make here is just a code fragment. You will lose 5 points for calling an undefined variable/keyword/label/etc. though.
- for every individual built-in keyword/statement/function/etc you use, you receive 15 points. These include
for
andif
, but also built-in functions such asreplace()
. Libraries do not count as built-in functions, but you're free to use them. - for every letter, number, or underscore in your code, you receive 1 point.
- for every line/block of code that is unrelated() to the story, or uses keywords/statements/etc with no meaning() in English, you lose 20 points, and the involved characters will not count towards the 1 point per letter/number. To keep it fair to the languages that need data types like
int
when defining variables, data types are ignored completely. This means they don't receive 10 points for being a keyword, they won't receive points for the involved characters, but they also don't cause point loss. - It is not allowed to just make something valid English by inserting a comment to "fill in the blanks".
- Since this is a popularity-contest, for every upvote to your answer you will receive 25 points.
- Make sure to specify which language your code is in, and the formula you used to count the amount of points your answer gets.
- The answer with the most points, using this system above, wins.
- Using this system, the above example code would get
4*15 + 53*1 = 113
initial points.
(*) over-analysation / objectification part: to keep this as objective as possible, "sensible" or "unrelated" means the following: If the piece of code uses words that are not English, it's not valid (for example, const
or int
are not English words, but foreach
or typeof
is 2 English words merged, so that is okay). Also, even if you use valid English words such as print
or echo
, these will have to fit in with the story with their original meaning (so 'putting ink on paper' and 'reflecting sound', not 'showing on a screen'). And with 'fit in', I mean that the subject of the story must be related to it.
I hope this last "disclaimer" meets the requirement of defining objective criteria.
There's a classic and amazing IOCCC winner that did this: http://ioccc.org/1990/westley.c
– Computronium – 2017-05-29T23:37:18.573Is it permitted that my program produce a runtime error? – H2CO3 – 2014-01-24T18:22:11.677
3@H2CO3 My feeling is no. – Jwosty – 2014-03-11T01:15:34.677