78
29
Write a snippet, a function, a programm, ... that is obfuscated in a way that it looks clear at the first sight that it does something else.
For example: write a bit of code that adds two number, but when you ask someone "what does it do?", he will tell you it prints "Hello, World!".
Rules
- The code must be readable for someone who roughly knows the language you use (avoid intrinsic obfuscated language like APL, in your own interest).
- The code must do something unexpected that the reader initially couldn't predict.
- When you ask different readers, they must have the same (wrong) opinion about what the code does.
Rating
- Please read other contestants' codes during maximum 10-20 seconds, just to have a good idea of what happens there.
- Add a comment to the answer saying what you think the code does. If the answer you want to give is already there, simply +1 the comment. (if you miss that answer and add another comment, don't worry, it won't be counted as another answer).
- The points will be awared this way: (
maxFalseOpinion
-goodGuess
) /totalOpinion
(see example below). - Rate other contestants with fairplay and don't comment your own code.
- Only add useful comments. Avoid "I don't know" and "good one!", they are not taken into account for the rating, but it's the code and not the ratings that must be obfuscated.
Rating example
The snippet adds two numbers. The comments say:
(3) It displays "Hello, World!"
(1) It substracts 2 numbers.
(2) It adds 2 numbers.
The total amount of points is the maximum number of opinions (3) - the number of good guesses (2) divided by the total amount of guesses (3 + 1 + 2 = 6). Result: (3 - 2) / 6 = 1/6 = 16.67%.
MORE ABOUT POINTS
People seem to have some trouble figuring out the points.
Here is a perfect score:
printf('Hello World');
comments:
It displays the number of time you have clicked a button. (17 comments).
TOTAL: 17 comments
Score: (17 - 0)/17 = 1 = 100%
Here is a lame score:
printf('Hello World');
comments:
It prints "Hello World". (13 comments).
TOTAL: 13 comments
Score: (0 - 13) / 13 = -1 = -100%
Here is a not so bad score:
printf('Hello World');
comments:
It prints the user name. (2 comments).
It displays the current time (15 comments).
It returns what you entered without modification. (3 comment).
It prints "Hello World" (1 comment).
TOTAL: 21 comments
Score: (15 - 1) / 21 = 0.6667 = 66.67%
Explaining :
15 is the main guess, what people said the most.
1 is the correct number of guesses.
21 is the sum of all comments.
5
Possible ideas for contestants (especially ones writing C) can be found at http://underhanded.xcott.com/
– shiona – 2013-04-23T08:17:50.417Hmm, I didn't know that! That is evil. Not quite the same goal, though. Thanks for the link! – SteeveDroz – 2013-04-23T08:23:19.610
3I have a feeling people would be reluctant to comment if they don't see the trick (because they'd obviously end up wrong). This would strongly modify the results. – ugoren – 2013-04-23T11:40:08.820
@ugoren : As a contestant, comment other peoples work. It's OK if the answer don't have the same amount of comments. But each must have some (I do comment as well, don't worry, I also feel dumb about not seeing the trick). – SteeveDroz – 2013-04-23T12:42:00.380
Question (I'm new to this exchange site, so sorry). If I don't know the language, should I still give it a shot :D? – TerryA – 2013-04-23T12:45:04.033
Hey, do you know any language? You can participate to this challenge in any language. It's not the case for some of them, but this one is ok. Why not trying a natural language? I would give at least a vote to a good intricated sentence that doesn't mean what it looks like (Example: my lady, you look like a twenty years old rose. [have you seen a rose after 20 years?]). – SteeveDroz – 2013-04-23T12:48:42.673
I know python :). But what I meant in my question was, should I rate other people's answers? Sorry for the confusion :x :( – TerryA – 2013-04-23T12:50:02.583
Ah! Yes, I think you can. If you know python, you know what
if
,for
andwhile
mean. You know what is a function, and so on. So if you don't understand anything to the code, don't rate it. If you think you understand (even if obviously you don't, because it's the point of the game), give it a try! – SteeveDroz – 2013-04-23T12:53:36.553Alright, thanks for clarifying! This looks like a fun challenge! – TerryA – 2013-04-23T12:53:59.663
2
@Haidro, I'd say that if you know the language just a bit, and seem to understand what the program does, then comment. If you can't make sense of it (e.g. I can't understand slackwear's answer), don't.
– ugoren – 2013-04-23T12:56:00.250@Oltarus, seems the last example computes the wrong score: There are 3 votes for "Hello World", so the rating should be (15 - 3) / 21 = 57.1...% – SeanC – 2013-04-23T14:45:42.947
Yes, I edited it 10 minutes ago. reload the page. – SteeveDroz – 2013-04-23T14:46:54.670
At least one answer works by using unicode characters that look like another one but are distinct. Is that within the spirit here? – Winston Ewert – 2013-04-24T14:04:38.873
1I know which one you're talking about. I'm not that happy about that, it's not the kind of trick I was expected, but it isn't against the rules as I wrote them, so... I'll have to accept it. – SteeveDroz – 2013-04-24T14:48:11.690
In some esoteric programming languages, EVERY program is like that. Examples: Chef, IRC, or several others from the thematic languages list.
– AJMansfield – 2013-04-24T21:22:35.910I'll say, I love the scoring scheme for this. It not only gives points for luring people away from the actual result, but also emphasises luring people towards the same wrong answer. A program where everyone guesses differently may very well score worse than one where half the people got it right, but everyone else picked the same wrong answer. – 3Doubloons – 2013-04-24T23:15:16.703
Thank you for the remark, it's exactly what I wanted: something that looks like something else, not something that looks like anything else. :-D – SteeveDroz – 2013-04-25T04:20:00.590
You may be interested in underhanded.xcott.com – Manishearth – 2013-04-25T07:48:02.163
2When does the challenge end? – Reinstate Monica – 2013-04-26T20:05:50.133
2When will it end? I really want to know the tricks behind some of these programs. – f.ardelian – 2013-04-26T22:00:31.910
1It will end when you won't expect it. As a matter of fact, it will end now! – SteeveDroz – 2013-04-27T06:20:01.273
Who won? (Not me...) – Reinstate Monica – 2013-04-27T06:23:53.620
Well, it just took me 20 minutes (max 1 comment every 15 seconds) to add a comment on each of the 50 questions (thanks guys for playing along!). Now people will rate themselves, because I don't every language. Feel free to comment any answer. now! – SteeveDroz – 2013-04-27T06:43:58.950
One thumbs up counts as a comment yea? – TerryA – 2013-04-27T06:46:36.910
Yes, exactly. So
2 It does nothing
means 3 votes. – SteeveDroz – 2013-04-27T06:56:06.257Shouldn't the lame score example above be
(13 - 13) / 13 = 0
? – Paul R – 2013-04-27T07:04:13.610What happens when somebody has an answer with no guesses?
ZeroDivisionError
? – Volatility – 2013-04-27T07:10:44.783The lame score is correct. You take the highest wrong answer. The lame score has 0 wrong answers → -100% – SteeveDroz – 2013-04-27T08:00:10.347
If someone has 0 guesses, well. I suppose it was too tough for anyone to answer. The rules of the game are not carved in stone. You can still give it a try to help them, if you think it's fairer. – SteeveDroz – 2013-04-27T08:01:34.443
4I think you should require a minimum number of guesses for a winner - I'd say 10. 1 wrong answer out of 1 isn't very impressive, yet it's 100%. – ugoren – 2013-04-29T14:38:58.930
1I already "do something that looks like something else". I sit at my desk all day, and it looks like I'm working... – WallyWest – 2014-01-20T23:04:02.723
Too bad the challenge ended, @Eliseod'Annunzio, you would have won! – SteeveDroz – 2014-01-21T14:27:20.573