text:
-ENDED- Do something that looks like something else
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.

Possible ideas for contestants (especially ones writing C) can be found at http://underhanded.xcott.com/

Hmm, I didn't know that! That is evil. Not quite the same goal, though. Thanks for the link!

I 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 : 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).

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?

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?]).

I know python :). But what I meant in my question was, should I rate other people's answers? Sorry for the confusion :x :(

Ah! Yes, I think you can. If you know python, you know what if, for and while 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!

Alright, thanks for clarifying! This looks like a fun challenge!

@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.

@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...%

Yes, I edited it 10 minutes ago. reload the page.

At least one answer works by using unicode characters that look like another one but are distinct. Is that within the spirit here?

I 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.

In some esoteric programming languages, EVERY program is like that.  Examples: Chef, IRC, or several others from the thematic languages list.

I'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.

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

You may be interested in underhanded.xcott.com

When does the challenge end?

When will it end? I really want to know the tricks behind some of these programs.

It will end when you won't expect it. As a matter of fact, it will end now!

Who won? (Not me...)

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!

One thumbs up counts as a comment yea?

Yes, exactly. So 2 It does nothing means 3 votes.

Shouldn't the lame score example above be (13 - 13) / 13 = 0 ?

What happens when somebody has an answer with no guesses? ZeroDivisionError?

The lame score is correct. You take the highest wrong answer. The lame score has 0 wrong answers → -100%

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.

I 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%.

I already "do something that looks like something else". I sit at my desk all day, and it looks like I'm working...

Too bad the challenge ended, @Eliseod'Annunzio, you would have won!

Javascript
var а;
a = 1;
а++;
alert( a );

Answer: It outputs 1. The comments below explain it pretty well - there are two different variables here, a - 'LATIN SMALL LETTER A' and а - 'CYRILLIC SMALL LETTER A'.
There was 1 correct answer, 50 people thought it outputs 2, and with a total of 52 answers, the score is (50 - 1) / 52 = 49 / 52 = 94,23%

Outputs 2 or at least that is what I hope :)

Outputs 1 or throws a TypeError. (I can't decide definitively, of course.)

This is the sneakiest JS snippet I've seen yet. Well played.

For those who don't get it (spoilers ahead): link

@soandos: (AGAIN, SPOILERS):  The variable used in the first and third lines is different from the one in the second and fourth.  One uses a (U+0061) while the other uses а (U+0430).  See also.

@BlueRaja-DannyPflughoeft, got it, feel free to delete now

Outputs true.

I'm pretty sure I'm wrong, but that's what I decided after a few seconds of looking at the snippet and before reading the comments, so I guess, I'm committed to it xP

A friend of mine thought this was pretty funny and was inspired to write this https://github.com/johnhaggkvist/WATifyJS - He had too little rep to comment so I'm doing it for him ^_^

@limelights - Great stuff. I'm glad this inspired someone to do something useful :)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Now only if everyone used "use strict;" before every such JS snippet...

http://meta.codegolf.stackexchange.com/a/1657/34543

Yeah, I know, but this answer is about a year older than that rule :)

C, Score 33.3%
#include <stdio.h>
int main(int ac, char **av) {
        const char *arg = av[1];
        #define valid_ch(ch) (ch!='&' && ch!='\\')  // All valid except & and \
        while (*arg)
        {
                if (valid_ch(*arg)) putchar(*arg);
                arg++;
        }
        puts("");
        return 0;
}

Run ./prog 'Hello & goodbye, world!'
Score
The correct answer is H\n (the while is part of the comment, thanks to the line ending with \, so there's no loop), given by 6 people.
The most popular mistake was Hello goodbye, world\n, given by 25 people.
(25 - 6) / 57 = 33.3%.
Thanks to Olivier Dulac for bothering to calculate.

Prints "Hello  goodbye, world!\n"...

It is an endless loop.

It prints nothing

Only prints the first character in the arg and a newline. So it prints H\n.

Prints: Hello  goodbye, world! (no \n) (2 spaces after Hello)

produces a SEGFAULT.

it writes endless Hs

Syntax error: unclosed (. (Because the valid_ch expands to the comment too, and the rest of the line, including the ), is commented out.)

I have no idea. The const char * looks suspicious.

Outputs 'H' (more chars to be able to save)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Total 57 answers: 6 thought H\n, 25 thought Hello goodbye, world!\n, 26 thought something else (at least it is when I made this comment). So score is (25 - 6) / 57 = 33.3%. (I hope this is correct?)

Now you can try adding syntax highlighting (bug) to this code :)

@AlvinWong, seems correct (didn't recount everything).

Well, I thought it outputs just H, can you explain, why new line is printed?

@ST3, puts("");

Oh man... I'm so stupid.

Python
a = []
for i in range(10):
    a.append(i * ++i)
for a[i] in a:
    print(a[i])

Rating

Good answer: Prints 0
1
4
9
16
25
36
49
64
64, each number on one line.
Explanation: Despite nobody getting the right answer, I consider this mostly a failed attempt, because nobody made the mistake I had intended. (I'll add a real explanation later if nobody else does.)
Number of good answers: 0
Number of peoply with same wrong answer: 7
Total number of answers: 11
Score: 63,64 % (rounded to two decimals)

Explanation
First, a list a is created and filled with values i * ++i. There is no ++ operator in Python, but there is a unary + operator, which does nothing for integers, and applying it two times still does nothing. So a contains the squares of the integers from 0 to 9.
I had put the ++ as a distraction and hoped that most voters would go on, thinking they had found the trap, and fall into the real trap. It didn't work out. Some thought that ++ is a syntax error, and the others still looked for the trap.
The trap
The trap was in the second for loop:
for a[i] in a:
    print(a[i])

I was sure that most people would think this prints out all the a[i], i.e. 0 1 4 9 16 25 36 49 64 81, each number on one line. That's what you get with this variaton, for example:
for x in a:
    print(x)

x is assigned the values in a, and then x is printed. In the first version, a[i] is assigned the values in a, and then a[i] is printed. The difference is, that in our case we have i == 9, and thus the value of a[9] is changed each time through the loop. When finally a[9] is printed, it has the value of a[8], and thus 64 is printed again.

Syntax error (no ++ in Python).

SyntaxError on the second for.

Prints 81 ten times

SyntaxError on the second for. This is amazing. This really should win. It took me 5 mins to understand what was happening lol!

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Cannot reproduce. Executing this on Python2/3 correctly raises a SyntaxError on the second for. Your score is (7 - 7) / 11 = 0%. [Note that 7 people gave this answe. rubik put an other comment instead of voting up, but its answer is the same, hence should be counted together.]

@Bakuriu: Why on earth should this be a SyntaxError? Ideone.com runs it without problems: link

@Bakuriu: Thanks for pointing out rubik's answer. I updated my score.

@WolframH I cannot run it on my pc. The interactive interpreter gives a SyntaxError on the second for.

Okay, I understand now. I knew that for a[i] in a would give a SyntaxError because it's something that I have already tried on it. But I must say that in this case python's syntax is broken.The interactive interpreter shouldn't behave differently. Also, according to the grammar, every expression should be valid, but if you try: for i+j, in a: you'll receive a SyntaxError: can't assign to operator which is simply wrong. According to the grammar you shouldn't get any error at compile time!

@Bakuriu: You need a : at the end of a for statement. The command line interpreter has no problems with the syntax.

@Bakuriu compile time in Python?

JavaScript, Score of -100%
I did not invent this, Gary Bernhardt did but it is one of my favourites
alert(Array(16).join("wat?" - 1)+", BATMAN!")

Outputs NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN, BATMAN! :)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Seems like that video is quite famous...

Is this -100%?...

Of course. The batman gives it away.

Should use atob("QkFUTUFOIQ==") for "BATMAN!"

Perl, 26.67%
Results:
This prints "I am ambivalent about saying anything at all."
my $num1,$num2 = @_; is missing parentheses.  Therefore, it is equivalent to my $num1; $num2 = @_;.  $num1 doesn't get set to anything.
Thus $num1 is never greater than zero. The bit about the secret fish world hidden off the screen is, err, a red herring, so that people think they have found the "trick".
Furthermore, the ternary operator is an l-value in Perl: 1 ? $a = 1 : $b = 2 actually means (1 ? $a = 1 : $b) = 2. Which means ($a = 1) = 2 is evaluated, setting $a to 2. Contrary to appearances, The second string is assigned to $num1.
In case you are wondering,// is the defined-or operator.  If the sub returned an undefined value, the string "Stuff did not happen." would be printed. But it doesn't actually happen.  It was just to give people another option.
Scoring:
Total correct: 5
Total guesses: 30
Score: (13 - 5) / 30 = 26.67%
no warnings;
no strict;
no feature;
no 5.16;
no Carp;

sub do_mysterious_stuff
{
    my $num1,$num2 = @_;

    if ($num1 > 0)
    {                                                                                eval q; $num1="This is a secret fish world. Carp cannot be repressed!" or
       $num1 = "Hello, world!";
    }
    else
    {
        $num2 > 0 ?
            $num1 = "What's up, world?":
            $num2 = "I am ambivalent about saying anything at all.";
    }

    return $num1;
}

print do_mysterious_stuff(1,1) //"Stuff did not happen.";

It outputs, I am ambivalent about saying anything at all.

It prints This is a secret fish world. Carp cannot be repressed!.

Not being a perl guru this should print Hello, world!.

Well, that's it guys.  I'm never dealing with Perl again.

Why does this print $num2?

Prints This is a secret fish world. Carp cannot be repressed! and then NaN on another line?

It will print I am ambivalent about saying anything at all, as $num1 remains undefined, and $num2 is set to the length of @_ as my $num1,$num2 = @_; is equivalent to my $num1; $num2 = @_;.

I guessed the right answer, but for wrong reasons. Very good, on a number of levels. Still can't figure out quite why that ternary operator does what it does.

@ContextSwitch and @aidan, the ternary operator is an l-value in Perl.  1 ? $a = 1 : $b = 2 actually means (1 ? $a = 1 : $b) = 2.  Which means ($a = 1) = 2 is evaluated, setting $a to 2. Also, as Primo pointed out, my $num1, $num2 = @_; doesn't do what you expect because the parentheses are missing.

It prints What's up, world?.

Some sort of error because // is not in-line comments in perl.. Also your semi-colon is at the end of those 'comments'

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

@Oltarus, I'm not quite sure I understand the scoring.  Feel free to edit my answer to correct it if I didn't get it right.  Thanks, this was a fun question.

It was almost good except you took the total number of votes (30) instead of the number of votes for the most given answer: 13 with Hello, world!. I edited your score.

Python, -54.8%
Answer: Raises SyntaxError: not a chance
from __future__ import braces

if (input() > 0) {
print 'You entered a positive number';
}
else {
print 'You didn\'t enter a positive number';
}

Good guesses: 24
Same bad guesses: 7
Total guesses: 31

Explanation:
from __future__ import braces is one of the easter eggs in Python. It is meant as a joke, saying that Python will never use braces for scoping in the future.

Tests if the result of a user-supplied expression is signed.

I suspect there are quite a few errors. Python programmers are stubborn ;)

This is a Syntax error!

SyntaxError: not a chance

@BoppreH Please limit yourself in stating the outcome without any kind of explicit explanation or upvote the comment that already states the result you think is correct. Other kind of comments only ruin the fun for following readers.

@Bakuriu Sorry, deleted the comment.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

PHP 52%
  $arg = 'T';
  $vehicle = ( ( $arg == 'B' ) ? 'bus' :
               ( $arg == 'A' ) ? 'airplane' :
               ( $arg == 'T' ) ? 'train' :
               ( $arg == 'C' ) ? 'car' :
               ( $arg == 'H' ) ? 'horse' :
               'feet' );
  echo $vehicle;

(Copied verbatim from here)
Explanation & Score

 The correct answer is horse. This isn't a trick or sleight of hand. Bizarrely, this is how the ternary operator is defined in PHP.
3 chose the correct answer: horse,
16 people chose train which is correct in literally every other language ever invented, except PHP.
25 answers total, giving a score of (16 - 3) / 25 = 52%

feet

prints train.

prints 'horse'.

http://phpsadness.com/sad/30

And that... is why you should almost always use parenthesis to indicate order of operations, even if you think you don't need them.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Typo in your edit. "3 got it right ('horse'), 16 people choose s/'horse'/'train'/ which is..."

C++ 28.9%
#include <iostream>

using namespace std;

void print( void ) {
  static int times = 0;

  switch( times ) {
  case 0:
     cout << "Hello";
     break;
  case 1:
     cout << "World";
     break;
  default:
     cout << "Goodbye";
     break;
  }
  times++;
}

int main(int cout, char* argv[]) {

  print();
  cout << '\n';
  print();
}

Solution

 The point of this code is to trick the user into thinking that a newline character will be printed between the text "Hello" and "World". Notice that the first parameter to main is named cout. Since, in the scope of main, cout is an integer, the << operator actually performs a left shift operation with a parameter of '\n', rather than printing a newline.
 The print function is there mainly to take attention away from the input parameters in main, but also to allow std::cout to be used without adding the namespace prefix.

Score
Courtesy of Alvin Wong

Total 38 answers:
12 thought HelloWorld (considering minitech's and zeel's are the same)
23 thought Hello\nworld  3 thought something else.
Score is (23 - 12) / 38 = 28.9%

Prints "Hello" in one line, and "World" in the next.

Prints "HelloWorld". Puts 1024 in cout if called without parameters.

Prints HelloWorld.

Prints HelloWorld. And performs a bit wise left shift on the integer "cout".

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Total 38 answers: 12 thought HelloWorld (considering minitech's and zeel's are the same), 23 thought Hello\nworld, 3 thought something else. So score should be (23 - 12) / 38 = 28.9%.

Ruby, 100%
display = lambda { puts "Hello, world!" }
display()

Correct answer:

 Prints "main" with no newline. Explanation: In Ruby, you can't call a lambda using the normal parentheses syntax. Instead, display() is interpreted as the built-in method all objects have: o.display prints o.to_s to standard output. Methods called without an object are interpreted as methods of "main", an Object that includes the Kernel module.

Score: 3 of the same wrong answer, no other answers.

Prints "Hello, world!"

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python, -28.13%
x = 0
while x < 10:
    if (x%2)==0: x += 2
else: x += 1

print x

This prints 11 because the else block, which belongs to the while, is executed after the loop is exited.

Maximum number of false guesses: 8
Correct guesses: 17
Total guesses: 8 + 17 + 7 = 32

Score: (8 - 17) / 32 = -28.13%

Fails because of missing indentation in else:

Prints 11 on one line.

This prints 10.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python: Rating: -27%
name = "Robin"
seek = "Seek and find holy grail"
favorite_color = "blue"

from os import *

print "What is your name: %s" % name
print "What is your quest: %s" % seek
print "What is your favorite color: %s" % favorite_color

The program prints:
What is your name: <value of os.name>
What is your quest: Seek and find holy grail
What is your favorite color: blue

Rating:
Total opinions: 22
12 correct
3 + 1 + 6 wrong [for Bakuiru's answer, I would say it was close but still incorrect as  os.name is a string (os.uname is a function)]
Rating based on that assumption and my understanding of the rating system:
  Maximum wrong = 6
  Correct = 12
  Score = (6-12)/22 = -27%

Prints What is your name: [operating system name], What is your quest: Seek and find the holy grail, What is your favourite color: blue on separate lines. Obviously [operating system name] is replaced by the actual name.

Displays the 3 last line with values name = "Robin", seek = "Seek and find holy grail" and favorite_color = "red", oh, no. blue! (AAARRGGGHHH!)

Prints something like What is your name: <function os.name at 0x....> etc.

Outputs What is your name: Robin, What is your quest: Seek and find holy grail, and What is your favorite color: blue on separate lines.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

I knew that the variables would be replaced by something by os, but I forgot that os.name is a string and not a function...

JavaScript, -46.7%
var getResult = function(n, notReadyYet) {
    alert("Calculating results...");
    if (notReadyYet) {
        setTimeout(getResult, 100, n);
    } else {
        sayResult(n);
    }
    return arguments.callee;
}

var sayResult = function(n) {
    if (n >= 10) {
        alert("That's a big number!");
    }
    if (n < 10) {
        alert("That's a small number.");
    }
    return n;
}

(function() {
    var input = parseInt(prompt("Please enter a number:"));
    var result = getResult(input, true);
    return result;
})();

You can run it here when you're ready (have a guess first!). If you scroll down far enough in the JS panel, you will see the code with a brief explanation.
Correct answer:

 After asking the user to enter a number, it will enter into an infinite loop and display "Calculating results..." alerts until the maximum call stack size is exceeded (although the jsfiddle example will stop after about 20 times). However, if a semicolon is placed after the closing brace of the sayResult function, it will work as mgibsonbr described in the comments.

Scoring:

Good answers: 9
Most popular false opinion: 2
Total answers: 15

It asks for a number with the question Please enter a number: and returns you answer followed by true.

it locks into an infinite loop by popping up "Calculating results" ad infinitum

It prompts for a number, alerts "Calculating results" twice, then alerts "That's a _ number"

It outputs That's a big number after a delay equal to the number you input in ms.

Depending on the browser and/or how the DOM is set up (I'm really new to JS), it outputs the name of the function that is called on page load.

Doesn't output anything (except 'Please enter a number' once and 'Calculating results...' twice), returns undefined.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python
import sys

class TwoPlusTwoIsFive(object):
  def __bool__(self):
    if 2 + 2 == 5:
      return True
    else:
      return False

two_plus_two_is_five = TwoPlusTwoIsFive()

if two_plus_two_is_five:
  print('{} is company'.format(sys.version[0]))
else:
  print('{} is a crowd'.format(sys.version[0]))

edit:
score (8-1)/9 == 77.7 %
correct output is '2 is company' on python 2, '3 is a crowd' on python 3.

2 is a crowd (in Python 2, 3 in Python 3).

2 is company (in Python 2), or 3 is a crowd (in Python 3).

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Damn special method renaming! :)

Javascript
var a = [];
a.push( "Hello" );
a.concat( [ ", ", "world", "!" ] );
alert( a.join("") )

Answer: It alerts Hello. The concat method does not modify the array - it returns an array which contains the concatenation of the array it's called on and any other supplied arguments.
15 correct, 26 wrong, 41 answers in total and the score is (26-15) / 41 = 11 / 41 = 26,83%

Alerts Hello, world!

It alerts Hello

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

C# 62.5%
int sum=0;
List<Task> threads = new List<Task>();
for (int i=1; i<=10; i++) {
  Task adder = new Task( ()=> sum += i );
  threads.Add( adder );
  adder.Start();
}
foreach (var t in threads ) {
  t.Wait();
}
Console.WriteLine("Sum of all numbers in 1..10 is: "+sum);

This is my first code golf.
The correct answer was: "something between 55 and 110". That's because whenever the "sum+=i" statement executes, it'll use the current value of i. This code might even execute after the for loop is done, at which point i has value 11. This makes the highest-possible value 110 (and you can make sure to see it if you slow down the lambda in your testing). The smallest possible value is sum(1..10), which is 55.

Good answers: 0
Only approximately good answers: 5
Number of times the most popular answer was selected: 5
Total answers: 8

score: strictly speaking, no one got it right so the score should be (5-0)/8=62.5%.
If we're willing to count "approximately good" as a correct answer, then the score is (5-5)/8=0%

Prints an indeterminate number from 55 to 100, inclusive.

It just prints 100.

Prints a 'random' number between 0 (inclusive) and 110 (inclusive)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

I'm happy that most people got it mostly right - presumably right enough that they'll know not to make that mistake in their code!

Even if you count no answer as correct, your score isn't 100%, but 5/8 = 62.5%, because the most common mistake was chosen by 5 people.

ah, you're right. Let me fix that.

Java
public class Puzzle {

    public static void main(String[] args) {
        String out = "Some ungodly gibberish";
        //char x = \u000a; out = out + " and then some more. ";
        System.out.println(out);
    }
}

First attempt at codegolf...
good answer: Prints Some ungodly gibberish and then some more. and a newline
Rating:

Maximum number of guesses 6
Total number of guesses 11
number of correct guesses 5 (0 if you're in pedanitc mode)

Score: 9% (55% in pedantic mode)

Prints Some ungodly gibberish and then some more.

Prints Some ungodly gibberish with a newline

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python 33.3%
def Test():
    False = True
    True = False
    if False:
        return False
    elif True:
        return True
    else:
        return None

a = Test()
print a

Note: Assume this is Python 2.x, and not Python 3.

When run, this code produced an UnboundLocalError: local variable 'True' referenced before assignment.

Raises a SyntaxError

Shouldn't that be False, True = True, False?

It is what it is. (either way, I think that doesn't make a difference in this case)

This prints True.

Raises an UnboundLocalError.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

PHP, 100%
First time posting to code gulf, hopefully this isn't to bad.
function word_to_num($word) {
 switch ($word) {
  case "one":
   return 1;
  case "two":
   return 2;
  case "three":
   return 3;
  default:
   return "error";
 }
}
function print_word($num) {
 switch ($num) {
  case 1:
   print "hello";
   break;
  case 2:
   print "world";
   break;
  case "error":
  default:
   print " ";
  }
}

$words = array("one", 0, "two");
foreach ($words as $word) {
 $result = word_to_num($word);
 print_word($result);
}

correct output is 'hellohelloworld'
score is (10 - 0) / 10 = 1 = 100%

Prints hello world.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Oh, haha. Darn PHP.

'one' == 0 => true. Quite clever.

Python, -83.3%
Answer: Prints a < b if the inputs are equal, a = b if the first is larger, and a > b if the second is larger.
a = input()
b = input()
print 'a', '<=>'[cmp(a, b)], 'b'

Good guesses: 11
Same bad guesses: 1
Total guesses: 12

Explanation:
cmp(a, b) returns 0 if both arguments are equal, 1 if the first is larger, and -1 if the first is smaller, which is why the wrong comparison symbol is printed.

Prints a = b if a > b a < b is a == b, or a > b if a > b

prints a = b for input a == b, a < b for input a > b, and a > b for input a < b

Prints a = b if a > b, a < b if a == b, a > b if a < b. (This is probably what @Foon meant.)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

I think that this is better than the score shows. If I hadn't beed in Error-Finding-Mode, I might not have found it.

Perl: 100% (4-0)/4
print (1 + 2) * 3, "\n";
#

This program prints "3" without a new line. Perl parses this instruction as
((print (1+2)) * 3, "\n")

so only the (1+2) is passed as an argument to print.

Prints 9 followed by a newline

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

C (Score: 4.45%)
Good guesses: 7
Maximum of wrong guesses: 6+2 = 8
Total guesses: 6+7+3+2+4=22
Solution: ??/ is a trigraph for \, so the newline is escaped and the scanf line is commented out. Therefore the program runs forever, printing Guess a number between 1 and 10:. The comments are a quote from Mozart (via fortune).
// Why not?/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

// What?/
int main(int argc, char** argv)
{
    // Why not?/
    int number;

    // Why should I not send it?/
    srand(time(NULL));

    while(1)
    {
        // Why should I not dispatch it?/
        printf("Guess a number between 1 and 10: ");

        // Why not??/
        scanf("%d", &number);

        // Strange! I don't know why I shouldn't/
        if(number == rand() % 10 + 1)
        {
            // Well, then/
            printf("You guessed right!\n");
            // You will do me this favor./
            exit(0);
        }
    }
}

Spoiler, how to compile and run:

 gcc test.c -trigraphs

Comments are just distractions. Program is "Guess the random number from 1 to 10".

"Guess a number between 1 and 10: Guess a number between 1 and 10: Guess a number between 1 and 10: " (and so on) without asking for input

Something evil is hidden in the comments as they look like C++.

Eventually, prints "You guessed right!", and a newline, and then ends.

The evil comment has something to do with trigraphs.

There are no trigraphs. It's just another distraction.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Java
public class Test {
    public static void main(String[] args) {
        String fmt = "%s - %04d\n";
        System.out.println(fmt.format("Padded value: ", 0x0c));
    }
}

The Answer
It prints Padded value: (with a newline).
String's format method is static, with the format being passed as the first parameter. I.e. the call above is equivalent to:
        System.out.println(String.format("Padded value: ", 0x0c));

Number of good answers: 2
Wrong answers: 9
Score: (9-2) / 11  = 63%

This prints Padded value:  - 0012\n

This prints "Padded value: ` followed by a newline character.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

CPython
if 'Hello' + 'World' is 'HelloWorld':
  print 'Hello'
if 'Hello' + 'World!' is 'HelloWorld!':
  print 'World!'

correct output is 'Hello'
score (14-3)/19 == 57.9 %

Prints nothing.

Prints Hello\nWorld!.

Prints Hello. (Implementation dependent.)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

C
#include <stdio.h>
#define SIX  1+5
#define NINE 8+1

int main()
{
    printf("%d\n", SIX * NINE);
}

Score = (3-16)/19 == -68.4%
Don't forget your towel.

It prints 42 + a newline

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

I just noticed your puzzle. I would have gotten it wrong xP I'm a Java/C# programmer, so that's my excuse...

C#
static void Main(string[] args)
{
     Console.WriteLine('H' + 'e' + 'l' + 'l' + 'o');
     Console.ReadLine();
}

Prints the sum of the ASCII values of each letter (500)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

To be fair, the first time I saw it I thought it'd print "Hello", but then did a double-take.

C++
#include <cstdio>

int main()
{
    int f;

    f or (f = 0, f < 1000, ++f,
        printf("H ello world !\n"));

    return 0;
}

Score = (1 - 6) / 7 = -0.71428571428571 = -71.428571428571%

That does nothing.

Doesn't compile.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

R: 100%
Not that imaginative but might puzzle some people:
sum(data.frame(rep(1,10),stringAsFactors=TRUE))

What do you think is the result?
Edit:
The answer was 20. Because of a missing s in stringAsFactors (instead of stringsAsFactors), the argument is not recognized so the function create a new column called stringAsFactors.  Because of vector recycling, the column contains 10 times TRUE which are converted to 1s in the sum, hence a total of 20 and not 10.
This answer was not given in the comments.
3 answers were given (all saying 10 more or less). Hence a score of an 100%, I guess.

Returns the value 10.

I initially thought it would return 10.  Sneaky... leaving off that one "s" really changes things...

@Dason I now realize that suppressing the second one would have been even sneakier: one would assume partial matching would correct for it but it turns out it doesn't.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

100%! Congrats!

Tcl
Inspired by ugoren
foreach c [split [lindex $argv 0] {}] {
    # Don't print the invalid chars & and \
    if {$c in "& \\"} {continue}
    puts -nonewline $c
}

Sorry, forgot an example string. Ok, run as

./charfilter.tcl 'Hello & goodbye, world!'

Edit
Right solution: It does not filter at all. (6x)
Max wrong answer: 4x
Total answers: 10
Score: -0.2

It just prints its argument and doesn't actually filter.

it prints its argument without " ", "&", "\".

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python
def greeting():
  try:
    return 'Hello World'
  finally:
    return 'HELL0 W0RLD'

print greeting().lower()

correct output is 'hell0 w0rld'
score (8-14)/22 == -27.3 %

Prints: hello world

Prints hell0 w0rld

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

JavaScript
var x = 0;
var y = !x * 4;
var z = !y;
alert("Z = "+z);

It alerts Z = false.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

<?php
for ($i = 'a'; $i <= 'z'; $i++)
    echo "$i\n";

That is my code, asked only two php developers and they were wrong, can you think that it should do and make a test, comments about that are welcome.

I don't know PHP well, but my guess would be that $i++ has to convert 'a' to an integer (0) and then 1 <= 'z' returns FALSE.  Meaning that only a is printed.

@flornquake so you said it is just a guess and it is wrong.

Python
I'm new to code golf so correct my if anything is wrong or I have misunderstood something
a = 0
b = 1
print b**a

New try:
print -1**0.5

Prints 1. Are you assuming people don't know what ** does?

It'd be a harder question if it was rather a**a ;) (but still not in the spirit of this Q, perhaps)

1

thanks for ur comments. will try to give improved answers in future.

+1 for the print -1**0.5

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Wow, I hadn't seen the edit. -1**0.5? I'd have gotten it wrong.

Q - 100%
server:":localhost:1234:username:password";
h:hopen server;
h@(-1;"Alert Message");

Score
The correct answer was not given. This exploits the fact that the underlying k instruction for  hopen (opening a handle to a remote instance) is the same as iasc (the indices needed to sort a list).

I don't know Q but I will guess (so that you can have a score) that it attempts to open a server and send an alert message if it fails doing so.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

C# - 100%
static void Main(string[] args)
    {
        var h = "Hello, world.";
        var key = "\u007C\u002D\u007C\u0033\u0031\u0031\u0030\u002C\u0020\u005C\u002F\u005C\u002F\u0030\u0052\u0031\u005B\u0029\u0021";
        var StringToHash = h + key;
        System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
        byte[] b = System.Text.Encoding.ASCII.GetBytes(StringToHash);
        byte[] hashBytes = md5.ComputeHash(b);
        try {
            System.Text.StringBuilder sb = new System.Text.StringBuilder(0, -32);
            for (int i = 0; i < hashBytes.Length; i++) {
                sb.Append(hashBytes[i].ToString("x2"));
            }
            Console.WriteLine(sb.ToString());
        }
        catch {
            Console.WriteLine(StringToHash.Substring(13));
        }
        finally {
            Console.ReadLine();
        }
    }

Answer: Prints "|-|3110, \/\/0r1{)!"

Number of good answers: 0
Number of people who answered mostly the same thing: 5
Total number of answers: 5
Score: (5-0) / 5 = 1 = 100%

it'll print... something? And then wait for ENTER.

It prints "Hello, world."

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

This one's kind of silly... I haven't memorized ASCII and so don't expect it to do anything in particular.

This kind of depends on whether or not you know what the StringBuilder and Substring args are supposed to do. But they're all kind of silly, aren't they?

JavaScript (V8)
(function a() {
    /* (function(package) {
     *  (function(a) {
     *      "use strict";
     *      var a\u005f = package;
     *      with(a_)
     *          this && a();
     *  })(a);
     * })();
     */

    var code = "";
    var match;
    var re = /[ /]\* (.+)$/gm;

    while(match = re.exec(a)) {
        code += match[1];
    }

    try {
        var package = {a: a};
        eval(code);
    } catch(ex) {
        console.log(/SyntaxError: (.+)/.exec(ex.stack)[1]);
        return;
    } finally {
        console.log(";-)");
    }
})();

The correct output is:

Unexpected strict mode reserved word
  ;-)

So my result is sort of 100%, but it was probably too confusing. The only important part is the commented code, actually; the rest of it finds the code, executes it, and gets the error. But JavaScript doesn't have multiline strings.
(package is an ECMAScript 5 future reserved word and so can't be used inside the strict-mode inner function. a\u005f is a valid variable name. I'd expect people to expect that the error was "Strict mode code may not include a with statement" or just "Unexpected token ILLEGAL".)

This tells me we should hope for Dart to come along.

Prints nothing but logs into the console: ;-)

Definitely too hard too make a useful guess

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python, -20%
Answer: Raises a TypeError.
from os import *

with open('random_bytes.txt', 'wb') as f:
        f.write(urandom(10))

Good guesses: 3
Same bad guesses: 2
Total guesses: 5

Explanation:
When everything from os is imported (from os import *), the builtin function open is overwritten. os.open expects an integer as the second parameter, hence the TypeError.

I would appreciate an explanation on how this answer isn't appropriate.

Raises a TypeError. [BTW: I don't understand the downvote too. An other answer uses a similar approach but wasn't downvoted...]

Prints 10 random bytes in the file random_bytes.txt

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Perl: 100%
my $x;
print $x++ ? 'Hello' : 'world';
print ++$x + ++$x . "\n";

Answer: world6 (with a line feed).
Explanation:
For perldoc :

Note that just as in C, Perl doesn't define when the variable is
incremented or decremented. You just know it will be done sometime
before or after the value is returned. This also means that modifying
a variable twice in the same statement will lead to undefined
behavior.

Score:
total answer : 4
good answer : 0
score : (4-0)/4 = 100%

prints world then prints 7\n, though i don't know perl so i don't know what my does

Balls, I mean't 5 not 7, oh well

@Griffin: my is just the way to declare variables.

Prints "world4" with no newline.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

The score should be (3-0)/4.

(C)Python:
text_a = '''Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sed orci leo. Quisque ac semper leo. Nulla a justo id nulla viverra gravida. Donec ornare semper venenatis. In fringilla placerat sapien, ut pretium nibh pharetra ut. Aliquam mauris mi, venenatis nec lobortis id, fringilla sit amet leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam consectetur turpis at neque pulvinar sit amet congue tortor luctus. '''

text_b = '''Per me si va nella città dolente,
Per me si va nell'etterno dolore,
Per me si va nella perduta gente.
Giustizia mosse il mio alto fattore:
Fecemi la divina potestate,
La somma sapienza, e 'l primo amore.
Dinanzi a me non  fuor cose create
Se non etterne, e io etterna duro:
Lasciate ogni speranza, voi ch'entrate.'''

if (1, 2) is (1, 2) and (1, 2)[0] is (1, 2)[0]:
    print(text_a)
elif (1, 2) is not (1, 2) and (1, 2)[0] is (1, 2)[0]:
    print(text_b)
else:
    import __phello__.spam

Good answer:

It prints the contents of text_b.

good answers: 2
total answers: 5
score = (3 - 2) / 4 = 25%
Explanation:
Python's compiler is smart enough to use a single value for integer constants but this optimization is not (currently) applied to tuples, hence (1, 2) is not (1, 2) but (1, 2)[0] is (1, 2)[0].

It prints the contents of text_b

It prints the contents of text_a. (Implementation dependent.) (I changed the comment, terrible typo...)

@WolframH I've added a clarification about the implementation. AFAIK all versions of the implementation I've used give the same result.

Yes, I believe so. And I answered what I believe happens for that implementation :-) (but could be wrong, of course).

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Side note: The optimization works for the empty tuple ().

@WolframH I think it works because the empty tuple "does not have the comma", i.e. it is an actual literal. When the bytecode is first generated tuple literals are actually represented as BUILT_TUPLE opcodes, but not the empty tuple(which is like an int or str). When peephole.c optimizes these BUILD_TUPLE opcodes it creates a new tuple constant for every opcode, hence duplicating every non empty tuple(and nothing is done, at the moment, to remove duplicates. It's highly probably an AST optimizer will be added in the future...)

@Bakuriu: Tuples are no literals anyway, so I don't understand your comment.

@WolframH Yes, I probably wrote it in a obscure way, and my assumption was wrong. Anyway, as I said, there is no optimization done by the parser/compiler for the tuples. The empty tuple has always the same id because it is special cased in the tuple initialization and it is a singleton. But the parser doesn't know that, and in fact in __code__.co_consts the empty tuple appears multiple times(but because it is a singleton, they are actually all the same object).

@Bakuriu: Ah, yes, that is much clearer. Thanks.

Python:
def f(n):
    result = []
    for i in range(n):
        result.append(lambda x: i - x)
    return result

n = 10
A = f(n)
for i in range(n):
    print(A[i](i))

Rating

Good answer: Prints
9
8
7
6
5
4
3
2
1
0, each number on one line.
Explanation: Ten functions are created, each subtracts its argument from i from, and each is defined with a different value of i. So A[i](i) should subtract i from i, shouldn't it? No! The value of i that is subtracted is the value of the local variable i of the function f. This is 9 after f(10) finishes, independent of which A[i] is called. Too bad only one voter fell into the trap ;-)
Number of good answers: 4
Number of peoply with same wrong answer: 1
Total number of answers: 5
Score: -60 %

Prints 9 8 7 6 5 4 3 2 1 0, each number on one line.

Prints 0 nine times.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python
Please give the expected output without executing the below line.

print -1 ** 0.5

It prints -1.0

Throws an exception

no it does not throw an exception in python 2.7

@Anbarasan -1. Giving explicit explanations of what happens/not happens simply spoils everything.

Prints a complex number close to (but probably not equal to) 1j.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python
Tested using Python 2.7 and 3.3. I've updated this post with a more readable version:
def e(code):
    return eval(code)

try:
    items = sorted(globals().items())[0][1]
    for item in dir(items):
        if item[4:] * 2 == '':
            globals()[item[0]] = getattr(items, item)
finally:
    e('print("Ni hao, shijie!")')
    print('What, you don\'t speak Chinese?')

The previous, more obfuscated version:
def e(s):
    return eval(s)
#

glob = globals()
items = sorted(glob.items())[int()][True]
s = type(type('', (), {'__getitem__': lambda a, b: b})()[:])(0b100, None)
try:
    for item in dir(items):
        if item[s] * 2 == '':
            glob[item[0]] = getattr(items, item)
finally:
    e('print("Ni hao, shijie!")')
    print('What, you don\'t speak Chinese?')

Score
The program exits without printing anything. The code within the try block loops through each item in __builtins__ and looks for names of 4 characters or less. It registers them in the global namespace, using the first character of their original name. By doing so, the 'exit' function becomes available as 'e', replacing the function defined before the try block.
2 incorrect answers, 2 answers total: (2 - 0) / 2 = 100%

Prints print("Ni hao, shijie!"). This one took me a while to decipher - quoting the OP, "The code must be readable for someone who roughly knows the language you use". This is quite the opposite.

You're right, too much obfuscation... I've added a more readable version now.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Perl: -33% (1-2)/3
sub foo {
  ($TRUE,$FALSE) = ("0 but true",0);
  return $TRUE and $FALSE;
}
print &foo;

This program prints 0 but true because Perl parses the return statement like
(return($TRUE)) and $FALSE;

not
return ($TRUE and $FALSE);

it'll print 0 but true

It will output 0.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

A little late, but I got some inspiration.
JavaScript
// I miss Python :(
function print(x) {
    console.log(x)
}

// Build the points.
x = (1, 2, 3)
y = (4, 5, 6)
z = (7, 8, 9)

// Swap x and y.
[x, y] = [y, x]
print(x) // Prints (4, 5, 6)

C++
#include <iostream>

#define ONE 1
#define TWO ONE+ONE
#define FOUR 2*TWO

int main()
{
    std::cout << FOUR << std::endl;
    return 0;
}

Output is 3.
Actually to have FOUR, definition should be 2 * TWO * 2, that looks really confusing.

Why that strange solution? In math if you want “21+1” to give 4 then you add parenthesis: “2(1+1)”. Same here: #define TWO (ONE+ONE).

@manatwork, exactly, I just answered into the question, for people who aren't really into preprocessor it looks like an output is 4 instead of 3.

JavaScript
I tried to keep it under 20 chars width. I hope the comments help.
f=function//functify
(s){
    var X;
    return new (X=
    function()
    {this.s=s},X.
    prototype.
    toString=
    function(){return
    this.s},X)(s)
}
w=function//wordify
(n) {
    return n
    ? f('world')
    : f('hello')
}
s=function//spacify
(a,b){
    return a
    + ' ' + b
}
m=function//main
() {
    alert(s(w(0),
    w(1)))
}
m()

If anyone figures it out, they probably know real pain. When I first stumbled across this a few years ago, it took me hours until I figured it out and I only understood it several months later when I read an article on JavaScript and I made the connection. You see, th͝e̸ ͢t̨hin͞g ̵is i̧͜n̶҉́ ̛͘͠J̷͟a͜͞v̶̧͠a̢̨͟͞S̷͞͞c͝r҉̶i̴͞͞p̷͟t̷̕҉ ̡͠z̨̢b͘͢ơ̢͜͞d̨̡͘i̷̛͜s̛͞è̡ a̵͘҉̕l̨͟͞s̶̶̀o͠͞ ̶͟͠͠b͢͟r̵i̶̡̛͟n̨҉̶g̸̴̕͡ ̕͞i̴̧n̢͜͡ ̵̧̀́͞ş͡͞o̷̧̧͜͜m̴̧ę̶b̶͞͠͝ee͜͡r̶̵̢.̴̶̸̢̨ a͢n̢d͜ ̸͟͞t̶͞h̶́a̕͘ţ ̴͢͟c̢a҉́n͘͟ r̴ea̧ll̸y͢ ̕m͞e̴s͡s with what you're expecting from your program.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

PHP
No comments this time. Comments should be on the HTML source that it will output, use backticks ( ` ) to escape HTML code in comments so Stack Exchange won't eat them up.
$funcs = array_shift(array_slice(get_defined_functions(), 1));
global $output;

function one() { return '<b>hello'; }
function two() { return ' '; }
function three() { return 'world'; }
function four() { return '!</b>'; }
function five() { echo '<pre>' . print_r($output); return '\n'; }

$output = array();
while ($funcs) {
    foreach ($funcs as $func) {
        $output = $output + array($func());
    }
    array_shift($funcs);
}

Whoever gets the answer is either a wizard or a liar.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

I know the competition is over, but I couldn't resist to post this idea.
Java:
public class QuadraticEq {
    /** Prints the roots of x^2 + bx + c = 0 (if they exists). */
    public static void root(double b, double c) {
        //System.out.print("x^2 + " + b + "x + " + c + ": ");
        double d = Math.sqrt(b*b - 4*c);
        double r1 = (d - b) / 2;
        double r2 = (-d - b) / 2;
        System.out.format(java.util.Locale.US, "%f, %f\n", r2, r1);
    }

    public static void main(String argv[]) {
        // Compute some square roots
        root(-0.9, 0.20);
        root(-0.4, 0.04);
        root(-1.4, 0.49);
        root( 0,   1);
    }
}

0.4, 0.5 0.2, 0.2 0.7, 0.7 NaN, NaN

Yet another piece of code (after the deadline):
Scala
object HW extends App {
  val yes = 1;
  val no  = 0;

  (6*7 % 2) match {
    case yes  => println("Hello world.");
    case no   => println("No, thanks.");
  }
}

doesn't print anything

@mniip It does, but what?

PHP
<?php
function num2alpha($n) {
    $r = '';
    for ($i = 1; $n >= 0 && $i < 10; $i++) {
        $r = chr(0x41 + ($n % pow(26, $i) / pow(26, $i - 1))) . $r;
        $n -= pow(26, $i);
    }
    return $r;
}
echo num2alpha(3752126) . " " . num2alpha(10786571);
?>

Prints a bunch of characters separated by a space, which I'm far too lazy to calculate.  I'll guess "Hello World" just because it makes sense and so you can have a score. :)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

VBA
Sub a()
    b = c = 1
    Debug.Print b, c
End Sub

Random guess: prints "1 1"

Prints either True or False (or however VBA prints boolean values) depending on whether c equals 1, then the value of c

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python
def test(foo, bar=[]):
    bar.append(foo)
    for i in bar:
        bar = bar * 2
    else:
        return i * len(bar)
    return bar

print [test(i) for i in range(3)]

Prints [0, 8, 48], unless I got the plutimications wrong :-)

Prints [0, 13, 208] (I think).

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Python
i = 1j
i = i ** 4
while (i ** 0.5).real:
    i -= 1
print(i)

Rating

Good answer: Prints 0j.
Explanation: The first line was inteded to make the reader aware of the fact that Python works with complex numbers out of the box. Then, the counter i is set to 1 + 0j and then is decreased until... well, until its real attribute has a falsey value. I had hoped to trick somebody into thinking that real means "this is a real number"; the loop would then go until i was -1. Apparently everybody knowing about complex numbers in Python also knows that real is just the real part of the number, and then 0j is the first falsey value. Also, everybody remmbered that it's 0j, not 0. I'm impressed!
Number of good answers: 2
Number of peoply with same wrong answer: 0
Total number of answers: 2
Score: -100 %

This prints 0j. (Btw, the parentheses are not required. A space is enough: i ** 0.5 .real)

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

I think I never used complex numbers in my programs, but I'm well aware that when operating with numbers the type can only go "up" (int -> long, float ->complex), never "down", hence the correct solution :)

Erlang
What will be printed?
-module(confusion).
-compile(export_all).
go() ->
    Pi = "3",

    case Pi of
        3 ->
            io:format("Phew; pi is still the same");
        _ ->
            io:format("Pi has changed: ~p~n", Pi)
    end.

The Answer
It prints:
 Pi has changed: 51

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Here it is for C
int main(){
    int a = 10;
    int b = 20;
    int c = a + b;
    printf("Hello World!");
}

Depends what language it is.

@histocrat: Well does not. In the first it looks like I have provided a solution for the original question, but actually I have implemented the example provided in the question.

It prints Hello World!. It also adds two numbers, but does nothing with the result.

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.

Ruby
puts "Please enter a boring sentence"
sentence = gets <<"!!!!!!!!111"
puts sentence
!!!!!!!!111

Edit: This might be getting downvoted because the user interaction makes it hard to test. Is that why? Hint:

$ Try typing this at the prompt it gives you: puts sentence

This is the end of the game, please rate yourself with the comments that are above this one. Edit your content and add the good answer, the number of good answers, the number of people that mostly answered the same thing, the total number of answer and your score. Don't forget that a 2 next to a comment means 3 answers. Comment freely below this.


text:
Mozart golf - mini "Rondo"
Output "Mozart - Alla Turca" to stdout (see the sample for "reference implementation")
Try to find how to pack both synthesizer and the music into minimal size.
Requirements:

Format suitable for feeding into aplay -f cd (signed 16-bit little endian, 2 channels);
Entire music should be played (no skipped notes or parts, at least not less than in sample program), polyphony is not required though;
Can't just call /usr/bin/timidity, /usr/bin/sox or something like that (e.g. require to install a special music module);
Can't access network or assume that the music is available locally;

"Reference implementation" with parsable score: https://gist.github.com/vi/5478693
(Old sample Perl program: https://gist.github.com/vi/5447962)

Do you have a link to sheet music?

No currently, I was typing the sample program by listening and trial&error. Now looking for...

For example, this.

Also, I assume you've already realised this, but everyone is going to use square waves.

Related question

@Peter Taylor, Polyphony and trying it to make sound nicer can be bonus points.

Having issue with your example - getting: Bareword found where operator expected at ./rondo.pl line 39, near "s![^ #]!!gr"
syntax error at ./rondo.pl line 39, near "s![^ #]!!gr"

@lochok, Does your Perl understand s/$pat/$sub/r expression? You may substitute it with my $tmp = $1; $tmp =~ s![^ #]!!g; my $n = length($tmp);

@Vi., /r was only introduced in 5.16.  Perhaps you should update the code to get rid of it, so more people can run it.

@dan1111, Done. (Note: I feel the music itself is a bit wrong in one place, maybe I'll fix it later also).

Note: the arrangement in the linked score is pretty useless for anyone trying to implement this with only one voice. I've downloaded various MIDI files and they don't agree on all of the notes - they can be in the same key, but disagree on some notes by 4 semitones! To make this a well-specified problem it really needs a single canonical score (preferably in some easily parsed format, so that implementers can convert it to a format convenient for their implementation without introducing transcription errors).

@Peter Taylor, Done (based on my MIDI file).

Polyphonic, Haskell, 2826 3177 4719
Audio output:
https://www.dropbox.com/s/nba6489tfet740r/hs-golf-turca.ogg
Features:

All notes from the right hand. I could of course add the left hand, too (done that).
Proper articulation of the staccato notes etc.
Reasonably nice sound with dynamics. Not just simple volume modulation, but proper morphing of the attack character and overtone content, like you get on a real piano actually, rather more... hey this piece is supposed to be imitating Turkish Janissary bands, right?
Reverb. Doesn't sound amazingly great, but not too bad, either.
Dynamic compression. Don't ask...
Dithering of the output. This is kind of ridiculous: with proper 16-bit resolution, hardly anybody would hear the quantisation artifacts, but to avoid including the binary library, I effectively use only 7-bits resolution, which I can cover with ASCII output. The dither itself is rather loud, no noise-shaping...
Multithreaded calculation of polyphonic chords.

import Control.Parallel
main=mapM_ (\(d,s)->(\p->p>>p>>p>>p).putChar.toEnum.round.(+d).(*62).min 2.abs$s+1).zip(dθ 1).lim.rev.hgp 9. pl 9e6 (\_->0) . ä
 $[mT%8.1,t2%16.1,t3(∡7)%8,t4%8,t5%16,t3(∡7)%8,mT%8.1,t2%16.1,t3(tev arp8)%8,cdT%99] >>= \e->[e,e]
mM=ä[2-^8,1-^8,0-^8,1-^8,3-^4]
cM=ä[7-^20,8-^20,9.^4,F[(7,0),(6,1)](map((∡2).(.^4))[6,5,6])%0.75]
cMv=ä[10-^2,8.^4,9.^4,hom(.^4)[[24,5],[23,8,12],[22,4],[21,6,9],[22,3],[19,5,8],[20,4],[18,6,9],[17]]#7&(-14)%2.5,tr 2%0.4,1-^9,2-^12,1-^1]%4.5
 ⋎(ä[6-^4,lp(8.^4∡3)%(3/4),sil%2,lp(5.^4∡3)%h,lp(5.^4∡2)%h,1-^1∡7]&(-14)#7#4%5)
mMa f=ä[(1-3*f).^4,lp(5.^4∡(-2-f))%0.75,mMa f%1.5,mMa(f*2)%h,mMa f%1]#7
mTm=ä[mM%1,mM&2%1,mM#4&4%h,mM&7%h,mM&7%1,8.^4,ä[10.^4]%0.2,cM%1,cM%1,cM%0.85,ä[4.^4∡2,5.^2]#6#4%2]#7
mT=p$ä[mTm%8.1⋎(ä[sil%h,mMa 0%4,mMa 1%2.75,2.^4,(-2)-^2]&(-7)%8)]
m2=ä[ä(map((∡2).(.^4))[1,2,3,3]++[es[6,5,4,3]%h]++[0-^2∡2])%2
 ⋎(ä[sil%h,1.^4,8.^4,3.^4,10.^4,5-^2]⊿1.3&(-14)%2)]
t2=p$ä[m2&2%1.8,0-^5,m2&2%2,m2#7%1.8,(-2)-^5,m2#7%2,mT%3.5,cMv]
m3=ä$[3-^4,4-^4,5-^2]++map(-^4)[3,4,5,4,3,2,1,2,3,4,2,0]
m3a=ä[(ä[sil%(1/8),lp(8.^4)%1]:zw(\d n->ä[sil%(d/24),n-^1]⊿cos d)[0..][1,3,5],s),m3a%1]
m3ra=(map((%1). \[a,b,c]->es[a,c,b,c,a,c,b,c])[[1,3,5],[1,4,6],[-2,0,5]]!!)
t3 o=ä[ä[o$ḋ[m3%4,m3%2.5,1-^4,4-^4,2-^4,0-^4]&(-2)%7.5,1-^2∡7]%8
 ⋎(ḋ[sil%(3/8),m3a&4%2,m3a%h,m3a#4%h,m3a&1%1,m3a&4%2,m3a%h,m3a&1%(5/8),5-^2]&(-18)%8)]
mQ=es[2,1,0,2]
m4=mM⇆4
i4 e=ḋ[m4⇅11%h,m4⇅9%h,mQ⇆4⇅8%h,F[(5,e),(4,1)][mQ⇅7%h,mQ⇅5%h,m4&5%h,m4&7%h]%2,es[10,9,10,9]#2%h ]
mla[b,c,d]=ä[b-^4,lp(c-^4⋎(d-^4))%1]%1
i4a=ḋ[sil%h,ä(map mla[[1,3,5],[2,4,5],[1,3,5],[0,2,5]])#5%4,ä(map mla[[1,3,5],[2,5,7],[2,6,8]])#4%3,5-^2⋎(7-^2)]
t4=p$ä[ḋ[i4 1%4,i4 0%2.5,ä[mQ⇅6%h,mQ⇅4%h]#4#2%1,3-^2]%8⋎(i4a&(-9)%8)]
mlaa=mla[1,3,5]
m5=ä$map(-^8)[1..4]
i5=ḋ[m5⇅6%h,m5%h,m5&4%h,m5⇅9%h]
i5d=hom(-^4)[[2],[4,5],[0],[4,5]]%1
i5a=ḋ[sil%h,mlaa,i5d,mlaa,mla[-2,0,4],mlaa,i5d,sq 4[1,-1,-3,-2,-6,1]%2]&(-7)
t5=ḋ[ḋ[i5%2,i5%1.5,ä[8-^4,9-^4]#1%h,i5%2,ḋ[es[5,4,3,2,3,5,1,3,2,4,0,2]%2]%1.5,1-^2]%8⋎(i5a%8)
 ,p(ä[ä[i4 1%4,es[3,2,3,1,4,3,4,3,4,3,4,3]#2#1&7%1.5,m5⇅13%h,mQ⇅8%h,m5&7%(3/8),6-^8,mQ⇅7#5%h,6-^2]%8
 ⋎(ä[i4a%3.5,F[(1,-1),(7,0),(6,1)][hom(-^4)[[-2],[3,5],[2,5],[1,5]]%1]%1,mla[-3,1,4],mla[-3,2,4],hom(-^4)[[-2],[1,3],[-2],[2,4],[1,3]]%1.5]&(-9)%8)])%8]⊿0.8
am d=3-^d∡2∡5
amf=1-^υ∡2⋎(5-^1∡3)
vh v(c,d)=lp(ä[v-^12]:map(\t->ä[t⊿0%0.04,t%d])c,d)
aam=vh 11.am
aar=ä[1-^10,4-^10,6-^1]&4
eam=vh 10.em
dm=6-^1∡2⋎(11-^1)
em d=5-^d∡2⋎(9-^1)
cdM=ḋ[4-^8,3-^8,2.^8,3.^8,cdM%1]
cdT=ḋ[ä[3-^(8/3)∡7,10-^6,am 1,am 1,cdM&7%1,dm,aam 4.05%1,em(4/3),12-^4,am 1,am 1,cdM&7%1,dm,aam 1%1,eam 4%1]%12.5⋎(ä(sil%(11/24) : map((%1).(m3a&))[4,4,4,0,4,1,4,4,4,0,4,1])&(-18)%13.1)
 ,p(ä[ä[ä[8-^2]⊿2%h,aar%(3/8),10-^8,aar%1,aar%1,cdM&7%1,11-^1,vh 11(10-^4)%1,9-^(4/3)]%7⋎(ä(map m3ra[0,0,0,0,1,0,2])&(-7)%7)])%6.75
 ,ä[p(ä[12-^4])%(1/4),am 1,am 1,cdM&7%1,dm,aam 1%1,eam 4%1,amf,ä[3-^4,1-^υ,5-^4,1-^υ,3-^4,1-^4,3-^4,1-^4,5-^4,1-^2]%3.75∡7,ä[amf∡(-14)]%0.56,ä[amf∡(-14)]⊿0.8%1]%12⋎(ä(sil%(1/8):map((%1).(m3a&))[4,4,4,0,4,1,4,4,4]++[m3a&4%h,m3a&4%h,5-^(8/5)])&(-18)%12)]
type D=Double
data F=N Int D|F[(Int,D)][([F],D)]
φ⇸F a fs=F a$map(\(f,d)->(map φ f,d))fs
_⇸N i d=N i d
i##c
 |i<1=(i+7)##c/2
 |i>7=(i-7)##c*2
 |1>0=1.06**(c i+case i of{1->0;3->3;4->5;5->7;6->8;7->10;_->fri i})
pl dur acc(N n v)=(\ω η->map(sin.(\x->x+τ x^2/η). \i->v*exp(-i*η/s)*τ(i*v)*(0.8-τ((i-dur)/90))*sin(i*ω))[1..dur])(n##acc/15.5).exp$fri n/9
pl dur acc(F accm fs)=pl' dur (foldr(\(q,m)f i->if q==i then m else f i)acc accm) fs
pl' dur _ _|dur<=0 = []
pl' dur _ []=map(\_->0)[1..dur]
pl' dur acc((f,dr):fs)|n<-min dr dur=trans(round n)(foldr1(\a b->sum a`par`sum b`pseq`zw(+)a b)(map(pl(n+99)acc)f))$pl'(dur-dr)acc fs
trans n a b|(f,ol)<-splitAt n a,(or,l)<-splitAt 99 b=f++zw(+)ol or++l
fri=fromIntegral
F a fs#q=F((q,1):a)fs
N i d&n=N(n+i)d
f&n=(&n)⇸f
N i d⇅n=N(n-i)d
f⇅n=(⇅n)⇸f
N i d⇆_=N i d
F a fs⇆n=F a.reverse$take n fs
N i d⊿v=N i$d*v
f⊿v=(⊿v)⇸f
p=(⊿0.3)
n.^q=([F[][([N n 1],s/2/q)]],s/q)
n-^q=([N n 1],s/q)
(l,d)⋎(r,_)=(l++r,d)
(l,d)∡j=(l++map(\h->ä[h⊿0%0.01,h&j%100])l,d)
f%t=([f],s*t)
tr n=F[]$cycle[n-^15,(n+1)-^20]
ä=F[];ḋ=F$zip[6,3,7][1,1,1]
lp=ä.repeat
sil=N 0 0
tev f(l,d)=(map f l,d)
h=1/2
υ=4/3
s=4e+4
sq d=ä.map(-^d)
es=sq 8
arp8 n@(N i v)=F[][([n,ä[n⊿0%(1/8),n&7⊿(v/υ)%100]],s)]
arp8 f=arp8⇸f
hom q=ä.map(foldr((⋎).q)$sil%1)
dθ l=2*asin l/pi:dθ(abs.sin$l*1e+9)
rev ls=(\z->z id(foldr(\m sg->(\v->z(*v)(map(*0)[0..m*14349]++sg)sg)$abs(cos$(m*3)^2)-0.6)ls.take 9$dθ 1)ls)$(.lwp 3 0).zw.((+).)
lwp ω c(x:l)=c:lwp ω((x+c*ω)/(ω+1))l
lwp _ _ _=[]
hgp ω l=zw(-)l$lwp ω 0 l
lime e(x:l)
 |abs(e*x)>1,e'<-((e*8+abs(1/x))/9)=e':lime e' l
 |1>0=e:lime((e*49999+1)/5e4)l
lime _[]=[]
lim ls=zw(\a u->τ$a/9+max(-2)(min 2$a*u)/6)(map(*0)[0..500]++ls).lwp 9 0.lime 1$hgp 9 ls
zw=zipWith
τ=tanh

$ make
  ghc -o bin/def0-hs def0.hs -O2 -fllvm -threaded
  [1 of 1] Compiling Main             ( def0.hs, def0.o )
  Linking bin/def0-hs ...
  time sh -c 'bin/def0-hs +RTS -N4 > hsoutp.pcm'
  189.39user 138.41system 2:06.62elapsed 258%CPU (0avgtext+0avgdata 6440240maxresident)k
  0inputs+0outputs (0major+403037minor)pagefaults 0swaps
  ffmpeg -loglevel panic -y -f s16le -ar 44.1k -ac 2 -i hsoutp.pcm hsoutp.ogg

Here's a partially ungolfed and commented version: https://gist.github.com/leftaroundabout/5517198.

Nice try. 2970 UTF-8 bytes, 2826 code points. As it is not a competitor for <600 python version, it could be better geared it towards nicer sound/polyphony (keeping it under 5000 bytes, for example).

@Vi. If you consider as "length of a program" the number of bytes when UTF-8 encoded then I think you should state that in the question. Just to make clear, since some people do not use this definition(e.g. every APL programmer...)

@Bakuriu Yeah, right LOL.

That was insane! I would love to get some idea how this program works.

@shiona: it's actually not that obfuscated, with type signatures it should be easy enough to understand for anyone familiar with Haskell and basic DSP.

@leftaroundabout: Thanks, I'll have to take a look at that. I have some experience with both. I also tried to run this on my system, but the program doesn't seem to output anything, am I doing something wrong / should I just wait for it to start?

Yes, it takes quite a while to get going – it first needs to render the whole first part before anything is sent to output. Make sure you compile with -O2 -threaded and run with +RTS -N<number of cores> to get as good performance as possible.

Python, 331+286 = 617 (0.548 bytes per note)
My solution uses a data file and a python script.  The data file should be used as input to the script.  I don't have aplay, but it works when I import it as raw data in Audacity with signed 16-bit PCM, little-endian, and 2 channels.
The data file is 331 bytes.  Here's a python script which outputs it:
import sys
sys.stdout.write('\x08\x1c\x9d\xb9"\xc7\xea\xf0\xb7)\xc0D!u\x0bB~\'\x91S\xb2\x0c\xe9\xf8T;\xfd\xc13\xcf\xb9\xa6r>\xbc\xc5\xb4\xbb\xf8\xa4\x9a\x05H\xa0\x1d\x0eIq\t\\+\t\xdbn\x03\xc3&\x98\xa0\x11\xc5\xaa\xef\xbcSR^\x13\xe7\xc7\x0e\xc0\xa9^\x91Z\xfc\x02\x11\xb9\x1bE\xfc/=\xb8\xaf5<\x12\xa2\xc4\x02\xec\xdcO\xc2a\x04<Q\xfd\xe9L\xbc\xab%\xf5wX1F\xa6\x88\xddP\xfec(_#\xb4\x0bN\xba&m\xe3\xa4\x08Q\xdb\xd9\xf3<Q\xc6\xf6\x0e\xd7\xacd\x1f"g\xce\xae.\xb0\x90{|\x04\xc5X\xe6x>\xefE\xc8\xb0\xd2?N\x83?\x04\x86"a\xcc\x9b\x8fq\x9c\xce\xa2\xb6f\x9ab\x92\x9e:\xc0S\xcd\th\xb1\x87\xecT\x9d\xf4\n\xaf\xc9$`E5\xcc\xc5\xa0m\xcc\n8\xf8:\x03\xf5\x02H\xf3k\xe5\x86\xa64\x90\xa2\xc2w\xfa\xb7\xc0\x1e*2\x93\xca\x12\xe3^!\xd5yQ,LXW\xb4\x96D\x8dB\x9c`\xbf\x96`s;\xb7}\xeb\x8c\xebI\xa0o\x00\x08\xfe\xf1\xd2M3}\x8e\xd0\xda\x97\'\xca\x83-\x14\xda\xa1ET\n\xe8\xc7@\x1c\xa2a\xbb\xa7\x1b\x014\xdcz\xc7\xa6\xc4\x1d\x18\x04\r\xb1\x9e\xe3\xd0\x18<\x98`N?a\xe4\x8e\x9d\xd5\r\xe7Z[\xf4\xed\xf1PQ')

Here's the python script:
import sys
k=0
m=185
p=[]
q=[]
for c in sys.stdin.read():k=k*256+ord(c)
while k:
    v=k%m;k/=m
    if v<184:q+=[v]
    elif v-m+1:q+=p[v-184]
    else:m+=1;p+=[q];q=[]
for n in q:r=[1,2,3,4,6,8,12,15,16][n%9]*2000;sys.stdout.write(''.join(chr(int(i*1.06**(n/9)/4.3)%99)for i in range(r*3))+'\0'*r)

Note: If you're running Windows, use the -u switch for both scripts since stdin and stdout are dealing with binary data.

Good job. Considering 331 + 286 + 10(for tying together the file and the script) == 627.

You can shorten a bit using os.read/write instead of sys.stdin/stdout.

+50 for the beautiful compression scheme. Using a grammar-based approach without entropy encoding I can't get that short just on the note values, without taking into account the lengths.

Can you describe how you compressed the data? I'm interested in knowing how you got it so small.

@Sir_Lagsalot: it's basically a nested / recursive dictionary, i.e. you have motifs consisting of notes (pitch and length encoded in one number), then you have themes that contain these motifs and/or single notes, then parts consisting of themes etc.. My program uses essentially the same principle (expanded by transpositions, inversions etc.), just not further compressed into a tight binary file; I've simply made everything top-level variable definitions instead.

@Sir_Lagsalot, my take on it is that it's a Lempel-Ziv style grammar code but that unlike LZ it uses explicit tokens to indicate the boundaries of the parts to repeat; and then it uses arithmetic encoding on top of that.

GolfScript (129 + 369 = 498 bytes)
Both program and data file include unprintable characters, so I'm going to give Base64 and xxd representations.
Program (129 bytes):
MjU2YmFzZSA2OWJhc2VbMDpOXS8oNDMse1xbMSQpXS9cMiQ9Kn0vXCwpey19KyUuLDIvL3ppcHt+
TisyNSU6Tid7goqSm6SuuMPP2+j2/0FFSU1SV1xcYWdtdCc9OmY7MTc2MCosey41MD4qZioxNy8u
Li59JScnOm4rcHV0c30v

0000000: 3235 3662 6173 6520 3639 6261 7365 5b30  256base 69base[0
0000010: 3a4e 5d2f 2834 332c 7b5c 5b31 2429 5d2f  :N]/(43,{\[1$)]/
0000020: 5c32 243d 2a7d 2f5c 2c29 7b2d 7d2b 252e  \2$=*}/\,){-}+%.
0000030: 2c32 2f2f 7a69 707b 7e4e 2b32 3525 3a4e  ,2//zip{~N+25%:N
0000040: 277b 828a 929b a4ae b8c3 cfdb e8f6 ff41  '{.............A
0000050: 4549 4d52 575c 5c61 676d 7427 3d3a 663b  EIMRW\\agmt'=:f;
0000060: 3137 3630 2a2c 7b2e 3530 3e2a 662a 3137  1760*,{.50>*f*17
0000070: 2f2e 2e2e 7d25 2727 3a6e 2b70 7574 737d  /...}%'':n+puts}
0000080: 2f                                       /

Data (369 bytes):
LoDJFvCRQqNdL7+JDvjtSkX4HBS2FwgvjfdxAHrF1/DcMIBtG/g7QZBLLYHpzgaWaM1TaHwbtxG+
l1lqsL3A8nuprtpPI20YbHm3lf7NxmYNdEIMTlhwTG+TlSn802DzN3YgIwbcKbtty9gWmF2nVS55
iJHQZd4HCcokoLRwH1g2XqP8Yo5xj5/YQm9DH85obUv47mii5n+PwsoJZ6yaz4eSpGps6dQMl+Pa
YP/WC6cVDBBGs3vq5cGe51H2u7oVArFuHrsI2sHkGNYHlhWudKn5RRvJhe3sxfrtQE/MekKRuZBt
f4B9qdyss66vFipSi1zf2MXF9A/CzwvMQ/t9PEtxw8kzxxikp2Ek3kc9TiamLl+iG2vjdWp84JzY
Mg6cE+3bFI4kVdn+d1NEnBR/S9HMnksgEc9sdAcyWsbSaGjwetwGTr7UXkpKO9aHF01D2i5pCO40
/keR0+a+NsBEOXZfatpXav44AJjalywtLeWu

0000000: 2e80 c916 f091 42a3 5d2f bf89 0ef8 ed4a  ......B.]/.....J
0000010: 45f8 1c14 b617 082f 8df7 7100 7ac5 d7f0  E....../..q.z...
0000020: dc30 806d 1bf8 3b41 904b 2d81 e9ce 0696  .0.m..;A.K-.....
0000030: 68cd 5368 7c1b b711 be97 596a b0bd c0f2  h.Sh|.....Yj....
0000040: 7ba9 aeda 4f23 6d18 6c79 b795 fecd c666  {...O#m.ly.....f
0000050: 0d74 420c 4e58 704c 6f93 9529 fcd3 60f3  .tB.NXpLo..)..`.
0000060: 3776 2023 06dc 29bb 6dcb d816 985d a755  7v #..).m....].U
0000070: 2e79 8891 d065 de07 09ca 24a0 b470 1f58  .y...e....$..p.X
0000080: 365e a3fc 628e 718f 9fd8 426f 431f ce68  6^..b.q...BoC..h
0000090: 6d4b f8ee 68a2 e67f 8fc2 ca09 67ac 9acf  mK..h.......g...
00000a0: 8792 a46a 6ce9 d40c 97e3 da60 ffd6 0ba7  ...jl......`....
00000b0: 150c 1046 b37b eae5 c19e e751 f6bb ba15  ...F.{.....Q....
00000c0: 02b1 6e1e bb08 dac1 e418 d607 9615 ae74  ..n............t
00000d0: a9f9 451b c985 edec c5fa ed40 4fcc 7a42  ..E........@O.zB
00000e0: 91b9 906d 7f80 7da9 dcac b3ae af16 2a52  ...m..}.......*R
00000f0: 8b5c dfd8 c5c5 f40f c2cf 0bcc 43fb 7d3c  .\..........C.}<
0000100: 4b71 c3c9 33c7 18a4 a761 24de 473d 4e26  Kq..3....a$.G=N&
0000110: a62e 5fa2 1b6b e375 6a7c e09c d832 0e9c  .._..k.uj|...2..
0000120: 13ed db14 8e24 55d9 fe77 5344 9c14 7f4b  .....$U..wSD...K
0000130: d1cc 9e4b 2011 cf6c 7407 325a c6d2 6868  ...K ..lt.2Z..hh
0000140: f07a dc06 4ebe d45e 4a4a 3bd6 8717 4d43  .z..N..^JJ;...MC
0000150: da2e 6908 ee34 fe47 91d3 e6be 36c0 4439  ..i..4.G....6.D9
0000160: 765f 6ada 576a fe38 0098 da97 2c2d 2de5  v_j.Wj.8....,--.
0000170: ae                                       .

Explanation
I've mangled the (updated) supplied score (more on that later) into a single string containing bytes with values from 0 to 24. The note lengths come first; then the note values, represented mod 25 and difference-encoded. The reason for the difference encoding is so that passages which are repeated in transposition will be reduced to the same sequence and can be compressed.
I then ran this through a string-to-GolfScript compression program which I've mentioned before (and which I improved in order to be competitive in this golf) to get the data file, which is decompressed by the first part of the program:
256base 69base[0:N]/(43,{\[1$)]/\2$=*}/\,){-}+%

It's a simple grammar expansion of a type which is familiar to anyone who's looked at many questions tagged kolmogorov-complexity.
I then split this string into pairs [length note] and iterate through the pairs. The non-printable characters come from a magic string which contains frequency parameters for the notes: I'm using GolfScript's implicit truncation mod 256 of integer arrays which are converted to strings to produce a triangle wave*, so the base frequency is 22050/256 Hz. I wrote a program to find integer ratios which give a good tuning; the magic string contains numerators, and the denominator 17 is the same for all notes. The average tuning error is about 3.4 cents.
The note lengths are represented as is, and are much more plausible than the previous version of the score. As I suspected, the rounding has increased the redundancy in the string and shortened the compressed data file by 30 bytes, not to mention saving the lookup array. However, there are still some passages which I find suspicious:
72 13

or
71 9
69 2
71 2

give bars which are a sixth of a crochet longer than the rest of the bars in the score, and
85 9
85 4
85 24
85 23

or
83 18
88 7
85 24
85 23

are an integral number of bars, but with some dubious offsets.
The program could be slightly shorter. I have deliberately chosen to trade in shortness for execution time. With some speed improvements to the GolfScript interpreter which I've submitted to Darren Smith and which I believe he plans to publish at some point, the current version runs in less than 15 minutes on my computer. If I don't puts each note after generating it then it runs much slower.
* I hereby confess that my comment about everyone using square waves was wrong.

How to properly run GolfScript? I try base64 -d <<< 'MjU2Y.....9Lw==' | golfscript and it says golfscript:405:in 'scan': invalid byte sequence in UTF-8 (ArgumentError) (the same if I save the program to file, of course)

Note lengths are extracted from MIDI file using crude algorithm (see the comment to the play.pl). I'll fix the notes lengths to be sane.

Updated the gist. Now minimal length of the note is 1.

If I try to run using online interpreter (the inserted code looks like 㔲戶獡㌷慢敳せ为⽝㐨ⰴ屻ㅛ⤤⽝㉜㴤紪尯⤬⵻⭽⸥㈬⼯楺筰乾㈫┵为笧誂鮒꺤쎸��䇿䥅前屗慜浧❴㨽㭦∩ĦĂ༃ጔ؏༆ณؕḧ⸘研��⒖✏㰢⭻⩽㐴Ⱚ⹻〵⨾⩦㜱ⸯ⸮╽✧渺瀫瑵絳/), I get undefined method class_id' for nil:NilClass`

@Vi., the program has to be extracted to a file (e.g. rondo.gs), and the data to another file (e.g. x), and then it's run as golfscript rondo.gs<x

And there's no way it will run in the online interpreter - that will time out.

md5sum golf.gs -> 9106c2fce9e03371b9b8cfbe14e1be2a  golf.gs; golfscript golf.gs < golf.dat -> /home/vi/bin/golfscript:405:in 'scan': invalid byte sequence in UTF-8 (ArgumentError)  from /home/vi/bin/golfscript:405:in 'compile'  from /home/vi/bin/golfscript:498:in '<main>'; md5sum /home/vi/bin/golfscript ->
31bc95e867d0771443208ca29fc824ca  /home/vi/bin/golfscript

@Vi., those md5sums are wrong: should be 2e62bb812b1f0428839a3e7ea18f384f  codegolf11463.data //  d5b641687fbf4218d42ed4c7c14abc20  codegolf11463.gs

Re-saved files, now md5sums are as you specified. Still the same error. Can you give md5sum and/or link to your GolfScript interpreter itself? Can Ruby version (1.9.3p194 i486-linux) matter?

@Vi., I saw the md5sums were wrong and didn't look closer. UTF-8?! It seems that Ruby 9 has added support for encodings other than ISO-8859-1, and that breaks a lot of assumptions that were previously safe. I'm using Ruby 1.8.7.

Fixed shebang from #!/usr/bin/ruby to #!/usr/bin/ruby1.8, now generating the music... MD5sums were probably for previous version of the script and datafile.

"However, there are still some passages which I find suspicious" -> patches to the gist are welcome. (still generating the output BTW)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
minigolf - display anything 3d
The goal is to write the smallest program in any language which displays any three dimensional output. It might be graphics, it might be ASCII art, but any reasonable person should immediately and unambiguously recognize it as "something 3d".
Opening external files or other resources is not allowed. All output has to be generated by your program.
The shortest code with a score higher than 1 wins.

Where are you going to find a reasonable person? This isn't objective enough to be called a spec.

@PeterTaylor : this is why I added the condition "score higher than 1", assuming that there are at least some reasonable persons reading and voting the answers.

@vsz, there are so many trivial answers to this question that you are probably better off making it a pure popularity contest.

@dan1111, or closing it as "not a constructive question".

FWIW, there was an attempt in the sandbox (which might still be ongoing) to define a good 3D drawing question

from the CowSay question: http://codegolf.stackexchange.com/a/11252/5011  (not mine, so not taking credit)

I agree with @dan1111. I vote to reopen, on the condition that the challenge is changed to a popularity contest.

HTML, 1 character
❒

This will appear as:
❒
There are several other characters that look three dimensional (at least to me) if you don't like that one:
❒ ❍ ✰ ✞ ➫ ➮ ➪ ♨ ✐ ✏

QBASIC 211 bytes
SCREEN 13
WINDOW(-160,-100)-(159,99)
FOR x=0TO 63
 PALETTE x,x*65793
NEXT
FOR i=16TO-16STEP-.1
 FOR j=16TO-16STEP-.05
  s=SQR(i*i/2+j*j/2)
  PSET(i*10,j*5+17.32*COS(s)),18.2*(COS(s)-SIN(s)*j/s)+31+RND
 NEXT
NEXT

The color for each pixel is chosen by adding the z value on the curve with the partial derivative with respect to y, generating a 'fake' lighting effect. The added random value helps to smooth the borders between regions. Produces something similar to the following:

That's a blast from the past.

PHP, 23 characters
<?=" __\n/_/|\n|_|/\n";

Outputs:
 __
/_/|
|_|/

Why not do it in GolfScript? You can use newline for one char rather than two inside '

Logo, 31 characters
My Logo is a bit rusty, but this should draw a torus:
repeat 180[rt 2 circle 45 fw 3]

Run it online: http://logo.twentygototen.org/9NxYy2Pw.

Lua, 12 characters
print'(.Y.)'

Python, 11 characters
print'()))'

Prints:
()))

It's a tube an overturned barrel.

+1 for linking to the Wikipedia page for cylinders, because the concept of tube definitely needed more explanation :D

Overturned barrel?

Mathematica 19
Graphics3D@Cuboid[]

Perl, 7 characters
print A

Prints a road (which has a line painted across it) receding into the distance.

...looks more like the letter A to me :P

@Volatility, then according to my working definition of reasonable, you aren't reasonable :)

Python 337 bytes
from pygame import*
from math import*
init();d=display;s=d.set_mode((640,480));a=0
def R(x,y,z,a):c,s=cos(a),sin(a);y,z=y*c-z*s,y*s+z*c;z,x=x*s-z*c-8,z*s+x*c;f=1e3/z;return-f*x+320,f*y+240
while s.fill(time.wait(5)):event.get();t=[R(x,y,z,a)for x in-1,1for y in-1,1for z in-1,1];[draw.line(s,-1,i,j)for i in t for j in t];a+=.01;d.flip()

A basic cube spinner.

Put R on one line, replace the nested for loop with [draw.line(s,-1,i,j)for i in t for j in t] and then put the whole while loop on a single line. That'll save you quite a few bytes.

R - 73 characters
Way longer than the previous answer but i like it:
t=seq(0,2*pi,.01);r=1e3:1;plot(r%o%cos(t),r%o%sin(t),col=grey(1:1e3/1e3))

Basically draw a thousand circles of decreasing radius and shade of grey.
Because of the default aspect ratio the result is more an ellipsoid than a sphere however.

Python, 0 characters
Output:
>>>

Which can only reasonably be interpreted as some sort of angled surface :). I prefer to think of it as a jagged, concave cliff face.

To me seems like the first step of a paper folding diagram…

LOL !!! 0 Charachters solution !! :D

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/