text:
Fast, Cheap, and Good - Choose any Two
As programmers, we all know the saying: "You can have it fast and good, but it won't be cheap, you can have it cheap and good, but it won't be fast, or you can have it fast and cheap, but it won't be good."
For this challenge, you are implementing an imaginary configuration tool for your custom programming services. You should render a set of three check boxes, with a heading of "SELECT ANY TWO":
SELECT ANY TWO
☐ FAST
☐ CHEAP
☐ GOOD
Once two items have been selected, the third item must be disabled. Upon deselecting one of the two selected items, all options must again be enabled. Put another way, if zero or one items are selected, all are still enabled, but if two items are selected, the third must be disabled.
No special controls allowed. The check boxes should be the standard check box in your language of choice. For example, don't use a "CheckBoxList" control, if your language has one. I'm imagining most entries will be HTML/jQuery, but that is not a rule. This is code golf, looking for the shortest entry.
WINNERS SO FAR
I'll break it down into categories. There are some clear winners:
jQuery:
nderscore, Mr. Tenacity Under 100b when you exclude text "resources". Honorable mention should also go to Matt for introducing the jQuery concepts that many took inspiration from.
Dyalog APL:
marinus, a.k.a. Mr. Unicode How do you type all those things? I can see why you would want to write short programs.
PHP:
SuperScript I believe this is the shortest entry that actually disables rather than deselecting the third option, following the strictest interpretation of the rules.

Can I just make it so that only two can be selected at a time? So that selecting the third de-selects one of the other ones? Or perhaps add an accept button that gets greyed out if 3 options are selected?

@Quincunx - Since there is no heuristic (outside of mind-reading) that could decide which one to deselect, this would confuse the user... so I'll have to say no, because we don't want the first impression of our custom software services to be a bad one. ;)

This question interested me in Python 3's tkinter, so I am trying to learn that now. IMO, the best way to learn GUI is by trial and error. I tried this: http://ideone.com/YHLZIQ . Result: rapid opening of new GUIs. I had to open task manager to close them. :-). Image (the number soon climbed to 340: http://i.stack.imgur.com/c9wQi.png)

The bonus contest should be another question as there is no objective primary winning criterion or any description of the "bonus". It said that code should be "...elegant and flexible..." and "...concise and clear..." which is against [tag:code-golf]. VTC as unclear what you are asking. Please don't radically change questions long after they are asked.

Fair enough, removed.

@BrucePierson Actually, there is. We could deselect the oldest selected checkbox. However, the code for that would be much more than the code you require.

@Quincunx Well, no question that your suggestion fits the precise definition of "heuristic" - certain parts of the definition, anyway. :)

Is it permitted to prevent the user from checking the 3rd checkbox instead of actually disabling it?

@nderscore yes.

What do you mean by "Don't use a check box list"? If you applied this too strictly, one wouldn't even be allowed to use jQuery.

"Do not use these controls for SQLite."

I've been having a discussion on meta, are the requirements for this challenge to write a function or a fully functional program? http://meta.codegolf.stackexchange.com/q/1550

@iamkrillin I think all the entries so far are executable in their context. Obviously a framework of some kind is usually present (browser, Qt, etc.). But it must display the page/form and allow interaction.

If something is good and cheap, it won't be fast. Therefore it won't be cheap either.

"Pick two" sounds much better than "Select any two"

Would we be allowed to simply have SELECT ANY TWO be the title of the window, rather than a label inside?

Javascript (ES5) with jQuery - 143 (Demo)
I modified Matt's solution and golfed it as far down as I think it can go:
$("*").html(["SELECT ANY TWO","FAST","GOOD","CHEAP"].join("<input type=checkbox onclick=(a=$('input:not(:checked)')).prop('disabled',!a[1])>"))

Javascript (ES5) without jQuery - 185 175 (Demo)
Using jQuery is kind of cheating, so here's a solution without it:
(d=document).write(["SELECT ANY TWO","FAST","GOOD","CHEAP"].join("<input type=checkbox onclick='for(b in a=d.querySelectorAll(\"input:not(:checked)\"))a[b].disabled=!a[1]'>"))

If we're allowed to prevent the user from checking the 3rd box instead of actually disabling the field, we can make it even shorter:
With jQuery - 126 123 (Demo)
$("*").html(["SELECT ANY TWO","FAST","GOOD","CHEAP"].join("<input type=checkbox onclick=this.checked*=!$(':checked')[2]>"))

Without jQuery - 150 147 (Demo)
(d=document).write(["SELECT ANY TWO","FAST","GOOD","CHEAP"].join("<input type=checkbox onclick=this.checked*=!d.querySelectorAll(':checked')[2]>"))

Cool.  Using .join is a good trick!

"SELECT ANY TWO0FAST0GOOD0CHEAP".replace(/0/g, is another way to do it resulting in the same length.

just being picky, the jquery version should use prop, not attr

@Einacio your wish is my command!

(Y) if it is with the same char lenght, why not promote good practices, right?

Nice work. Agreed on the .join, great approach.

@Einacio But codegolf is about worst practices! :P

@nderscore is officially at 99b with jQuery once you take out the required text "resources". That is going to be tough to top!

The second solution doesn't work if you use the keyboard to check the checkbox, does it?

@JanDvorak pressing spacebar while the checkbox is in focus does trigger a click event, so it works.

JavaScript - 184 169 (with jQuery)
b="input",a="<input type=checkbox>",c=":checked";$("body").html("SELECT ANY TWO"+a+"FAST"+a+"GOOD"+a+"CHEAP").click(function(){$(b).not(c).attr("disabled",!!$(b+c)[1])})

http://jsfiddle.net/L33JK/16/
EDIT: improved with help from @Daniel Lisik - https://codegolf.stackexchange.com/a/26805/16278

Nice! Not enough rep to upvote... but you're hired!

The more I look at this, the more I'm learning. The cleverness of the variable assignment inside a jQuery selector. Very cool. Also, could you explain what the "double bang" (!!) is doing?

The single bang, coerces a boolean value, and double will obviously invert that. undefined coerces to true. That and the variable assignment are probably the only little tricks used really.

Your code can be reduced to 179 characters like this: a="<input type='checkbox'>",b="input",c=":checked",$("body").html("SELECT ANY TWO"+a+"FAST"+a+"GOOD"+a+"CHEAP").change(function(){$(b+":not("+c+")").attr("disabled",!!$(b+c)[1])}) http://jsfiddle.net/L33JK/15/

Even less in the comment I left on yours, 169!

if you're defining b=input, can't you make a = "<"+b+" type=checkbox>"?

@Charles you can, but there won't be any difference in character length, (#+b+" is 5 characters and so is input).

Hey, nice solution! You can save two more bytes using !!$(c)[1] as :checked should only apply the <input>s anyway!

143: http://jsfiddle.net/_nderscore/69Ted/

since the inputs are the only elements, you can set b='*' and it'll work the same

@Einacio the body tag will be captured by * as well

@nderscore so? that only means the body will be set a disabled attribute that doesn't affect it. also, only !!$(c)[1] is needed, since :checked only filters the checkbox. speed is not important here

It only matters in my 143 solution above. Nevermind :)

Dyalog APL (on Windows) (169)
This is a static function, to test it if you don't know APL, type )ed C and paste this in the edit window, then run C.
C
'R'⎕WC'Form' 'Select any two',2/⊂S←2/20
1 21 41{('R.',⊃⍵)⎕WC'Button'⍵(⍺1)S'Check'('Event' 'Select' 'F')}¨'Fast' 'Cheap' 'Good'
B←R.(F C G)
F←{B.Active←X∨2≠+/X←B.State}

Newer bits of APL have long keywords. I still beat HTML though.
Explanation:

'R'⎕WC'Form' 'Select any two',2/⊂S←2/20: create a form R, with title Select any two and size and position 20 20. Also stores 20 20 in S.
1 21 41{...}¨'Fast' 'Cheap' 'Good': for each of these pairs of data (name and y-coordinate, which are the only variables that differ between the checkboxes:

('R.',⊃⍵)⎕WC'Button': create a button within R with the first letter of the name,
⍵(⍺1)S'Check': with the right argument as the title, (left arg, 1) as position, reusing S as the size and Check as style,
('Event' 'Select' 'F'), which calls the function F when clicked.

B←R.(F C G): use B as an abbreviation for the three checkboxes we created
F←{...}: define the callback function as:

X←B.State: get the state for each checkbox and store them in X,
X∨2≠+/X: sum X, if this is not equal to two all checkboxes must be active, if it is equal to two only checked checkboxes must be active
B.Active←: enable or disable the checkboxes

Result:

Great explanation, thanks!

Python 3 2, 454 434 ... 393 392 bytes
I thought, Python must be shorter than Java. Here is the "proof" (EDIT: now it really is shorter):
from Tkinter import*
t=Tk()
r=str.replace
exec r(r(r(r('a@b@c@l=Label(t,text="SELECT ANY TWO");A`FAST|a);B`CHEAP|b);C`GOOD|c);l^A^B^C^','`','=Checkbutton(t,text="'),'|','",v='),'^','.pack();'),'@','=IntVar();')
def f(p,b,B,s):
 for i in 0,1,2:
    y=b[i].get()
    if p[i]-y:
     p[i]=y;s-=1
     if p[i]:s>0and B[i].toggle();s+=2
 t.after(1,f,p,b,B,s)
t.after(1,f,[0]*3,[a,b,c],[A,B,C],0)
t.mainloop()

For those of you curious as to what the exec expression actually executes, it executes this (this is what the replaces do to the string. Newlines added for readability):
a=IntVar();
b=IntVar();
c=IntVar();
l=Label(t,text="SELECT ANY TWO");
A=Checkbutton(t,text="FAST",v=a);
B=Checkbutton(t,text="CHEAP",v=b);
C=Checkbutton(t,text="GOOD",v=c);
l.pack();
A.pack();
B.pack();
C.pack();

This uses the same logic as my Java answer: unselect the checkbox if it causes more than 2 checkboxes to be selected. Unf Fortunately Unfortunately, I spent more less more bytes doing this.

EDITS:

massive adjustment of code to use exec, saving a whopping 1 byte!
switched to python 2 to squeeze two bytes from the exec (removing parentheses).
more golfing. Includes changing range(3) to 0,1,2 and changing the indentation to have one layer of tabs. Unsure if \t\t would work instead of \t__(_ is the space character). Finally reached the longest my Java answer ever was.
used replace trick
used Bakiru's suggestion, and golfed some more. Actually made it shorter than Java! But now, the Java answer got golfed more, so this is again longer. :-(
used improved replace trick.
changed a != for a -.

Interesting approach. +1

I can cheat with the turbo mode on my keyboard. First, I check two boxes. Second, I use Tab to highlight the third. Now I hold Space Bar in turbo mode for a few seconds. Sometimes, this checks the third box!

@kernigh I believe that is because my code gets to the point where it knows that the box has been toggled, but the code hasn't reached the point where it re-toggles the box. So if you toggle the box in that time (to off), my code will put a checkmark on it.

You can avoid the indented block starting with if p[i] using an and instead of an if: if p[i]:s>1 and B[i].toggle();s+=1.

@kernigh I was wrong; replacing B[i].toggle() with B[i].deselect() doesn't change anything. I have no idea why this is so. Perhaps it is a flaw with tkinter

Java, 421 ... 369 351 bytes
import java.awt.*;class F extends Checkbox{F(String s){super(s);}public static void main(String[]a){new Frame(){{add(new Panel(){{add(new Label("SELECT ANY TWO"));F[]c={new F("FAST"),new F("CHEAP"),new F("GOOD")};for(F b:c){add(b);b.addItemListener(e->{int x=0;for(F d:c)x+=d.getState()?1:0;if(x>2)((F)e.getSource()).setState(1<0);});}}});}}.show();}}

Java... because Java. Nicer looking code:
import java.awt.*;

class F extends Checkbox {
    F(String s) {
        super(s);
    }

    public static void main(String[] a) {
        new Frame() {
            {
                add(new Panel() {
                    {
                        add(new Label("SELECT ANY TWO"));
                        F[] c = {new F("FAST"), new F("CHEAP"), new F("GOOD")};
                        for (F b: c) {
                            add(b);
                            b.addItemListener(e -> {
                                int x = 0;
                                for (F d: c) {
                                    x += d.getState() ? 1 : 0;
                                }
                                if (x > 2) ((F) e.getSource()).setState(1 < 0);
                            });
                        }
                    }
                });
            }
        }.show();
    }
}

Sample run (different sizings of the window, first is on startup):

The checkboxes are arranged horizontally; this is allowed. It would take much more to align it properly. Also, I'm disabling by unchecking the box when it is clicked, not by making it impossible to be clicked.
EDITS:

saved 3 bytes by making the main class extend Checkbox.
reread Lambda Expressions and realized that the type name was unnecessary. Take that Python!
converted a while loop to a foreach loop (thanks Lee); why didn't I think of that before?
saved 18 bytes by using an anonymous class and an instance initalizer for both the Frame and Panel.

No restriction on the alignment (so I suppose Matt could reduce his by 5 characters). Props for a complete running program... but I don't see that the third option is disabled.

@BrucePierson It is disabled. It cannot be clicked. If it is clicked, nothing happens.

Ah, I think I see. You're immediately "unsetting" the checked state without disabling? That would be acceptable.

@BrucePierson That's right. To actually disable, I'd have to change if(x>2)((Checkbox)e.getSource()).setState(1<0); to if(x>2){Checkbox b=(Checkbox)e.getSource();b.setState(1<0);b.setEnabled(1<0);}

That works. Thanks for the edit on the OP, by the way - looks much better. :)

@BrucePierson Whenever you think, This looks funny when it has to do with using a character representation of some graphical thing, look for unicode. Alternatively, for graphical design things, turn to User Experience SE: http://i.stack.imgur.com/xFkzy.png

You can save 4 bytes by getting rid of the spaces around the equals signs for variables f and p.

@corsiKa Thanks. I usually miss some stuff like that when I shrink my code. I need to write an auto-golfer (preferably a regular expression that I can run in Netbeans with replace) that does that for me.

You could replace the while(i<3){x+=c[i++].getState()?1:0;} with for(F d:c){x+=d.getState()?1:0;} which would save a few characters.

I'd do Arrays.stream(new F("FAST"), new F("CHEAP"), new F("GOOD")).foreach(/*stuff*/) to save some more code.

Why 1<0 and not just false?

@SimonKuang 1<0 is 3 chars. false is 5. And your other suggestion is longer.

Sadly, if(java.util.Arrays.stream(c).allMatch(F::getState)) is longer than int x=0;for(F d:c)x+=d.getState()?1:0;if(x>2)

Rebol, 219 197
load-gui p: func[p][p/state/value]x: func[v][if all[p a p b p c][set-face v false]] view [title"SELECT ANY TWO"a: check"FAST"on-action[x a]b: check"CHEAP"on-action[x b]c: check"GOOD"on-action[x c]]

Ungolfed:
load-gui    ;; this is temporary while r3-gui is in beta

p: func [p] [p/state/value]

x: func [v] [
    if all [p a p b p c] [set-face v false]
]

view [
    title "SELECT ANY TWO"
    a: check "FAST" on-action [x a]
    b: check "CHEAP" on-action [x b]
    c: check "GOOD" on-action [x c]
]

This is the Rebol 3 View dialect (r3-gui).  Screendump below from Ubuntu Linux:

Update - Thanks to Earl & Graham from Rebol SO Chatroom for shaving 22 chars of the code - http://chat.stackoverflow.com/transcript/message/16345039#16345039

It is invalid answer, as third is disabled but also checked, that means all 3 are checked, so please fix it.

@ST3 - You are incorrect I'm afraid.  The "GOOD" checkbox isn't checked or in fact disabled (my code simply flicks the third box checked OFF).  This is how Rebol 3 view shows an unchecked box (by default).

@ST3 et al - Here is a link showing default checkbox look I've described above (1st image shows no checkboxes clicked, 2nd just "GOOD") - https://plus.google.com/u/0/104216037702741908932/posts/Z2EbuQX67aq

Well... I look into print-screen you added and I see all three checkboxes checked, just only one cannot be unchecked.

@ST3 - A greyed out checkbox is just Rebol 3 View way of showing that it's a checkbox that can be checked.  The tick turns green when checked and turns back to grey when unchecked.  These are the defaults.  In the image in answer above you can see that "GOOD" as the input focus (blue blur) because its being "clicked" but it remains grey and not green (so not checked).

C++11/Qt5.2 - 561 481 433 423 369
Because why not.
Shockingly, as of now we are shorter than Python, and the non-buggy C#, and tied with Java!
Credits to EveBird for cutting it down from 561 to 481.
And once more EveBird shortens it from 481 to 433!
Took a few off with a lambda connect
Down to 389 with C++11 initializers
And 373 without the separate class
Removed a few spaces - 369
Golf'd:
#include<QtWidgets>
#define C(x,y,z)z.setEnabled(x.isChecked()+y.isChecked()<2);
#define S(x)l.addWidget(&x);
#define X(x)S(x);x.connect(&x,&QCheckBox::clicked,[&](){C(g,f,c)C(g,c,f)C(f,c,g)});
int main(int n,char**v){QApplication a(n,v);QWidget m;QLabel t{"Select any two"};QCheckBox g{"Good"},f{"Fast"},c{"Cheap"};QVBoxLayout l(&m);S(t)X(g)X(f)X(c)m.show();a.exec();}

Sort of Un-Golfed:
#include<QtWidgets>

#define C(x,y,z)z.setEnabled(x.isChecked()+y.isChecked()<2);
#define S(x)l.addWidget(&x);
#define X(x)S(x);connect(&x, &QCheckBox::clicked, [&](){C(g,f,c)C(g,c,f)C(f,c,g)});

int main(int n,char**v){
    QApplication a(n,v);
    QWidget m;
    QLabel t{"Select any two"};
    QCheckBox g{"Good"},f{"Fast"},c{"Cheap"};
    QVBoxLayout l(&m);
    S(t)X(g)X(f)X(c)m.show();
    a.exec();
}

+1 for the self-flagellating "why not" :)

Can improve a bit more: replace QWidget m with QDialog m and m.show();a.exec() with m.exec().

CoffeeScript - 167, 154
CoffeeScript port of @Matt's answer.
b="input";a="<input type=checkbox>";c=":checked";$("body").html("SELECT ANY TWO#{a}FAST#{a}GOOD#{a}CHEAP").click ->$(b).not(c).attr "disabled",!!$(b+c)[1]

Somewhat ungolfed:
b = "input"
a = "<input type=checkbox>"
c = ":checked"

$( "body" ).html( "SELECT ANY TWO#{a}FAST#{a}GOOD#{a}CHEAP" ).click ->
    $( b ).not( c ).attr "disabled", !!$( b + c )[1]

JSFiddle.

Thanks to Rotem and Johnbot for the golfing help!

C# 343 334
This one uses the same "cheat" as Quincunx's Java answer - the checkboxes aren't actually disabled; they just don't allow you to check them if that check makes 3.
using System.Windows.Forms;using System.Linq;class P:Form{static void Main(){P p=new P();p.Text="SELECT ANY TWO";int y=0;var a=new CheckBox[3];foreach(var n in "FAST CHEAP GOOD".Split()){var c=new CheckBox();a[y]=c;c.Top=y++*50;c.Text=n;c.Validating+=(s,e)=>{if(a.Count(b=>b.Checked)>1)e.Cancel=true;};p.Controls.Add(c);}Application.Run(p);}}

There's also a minor bug that you can't close the window after selecting the third checkbox unless you unselect one, because the validation won't pass. But this is code-golf, so who cares? ;)
C# 403 397 374
This is a proper one that actually disables the third checkbox.
using System.Windows.Forms;using System.Linq;class P:CheckBox{static void Main(){var p=new Form{Text="SELECT ANY TWO"};P[]a=null;a="FAST CHEAP GOOD".Split().Select((x,i)=>{var c=new P{Top=i*50,Text=x};c.Click+=(s,e)=>{a.First(b=>!b.Checked).Enabled=a.Count(b=>b.Checked)>1?1<0:a.All(b=>b.Enabled=0<1);};p.Controls.Add(c);return c;}).ToArray();Application.Run(p);}}

Kinda ungolfed:
using System.Windows.Forms;
using System.Linq;

class P:Form
{
    static void Main()
    {
        P p = new P();
        p.Text = "SELECT ANY TWO";
        int y = 0;
        var a = new CheckBox[3];
        foreach (var n in "FAST CHEAP GOOD".Split())
        {
            var c = new CheckBox(); a[y] = c; c.Top = y++ * 50; c.Text = n; c.Click += (s, e) =>
            {
                if (a.Count(b => b.Checked) == 2)
                {
                    a.First(b => !b.Checked).Enabled = false;
                }
                else
                {
                    foreach (var b in a) b.Enabled = true;
                }
            };
            p.Controls.Add(c);
        }
        Application.Run(p);
    }
}

Couldn't if(a.Count(b=>b.Checked)==2)e.Cancel=true; be rewritten as e.Cancel=a.Count(b=>b.Checked)==2;?

@Rotem Yes, yes it could. I'm dumb. And there's a similar optimisation for the other one. Thanks!

Wait, no, there isn't for the other one. Eh, still saved some chars.

If you switch the inheritance to CheckBox, use object initializers and abuse Linq a bit you can get the proper one down to 374: using System.Windows.Forms;using System.Linq;class P:CheckBox{static void Main(){var p=new Form{Text="SELECT ANY TWO"};P[]a=null;a="FAST CHEAP GOOD".Split().Select((x,i)=>{var c=new P{Top=i*50,Text=x};c.Click+=(s,e)=>{if(a.Count(b=>b.Checked)>1){a.First(b=>!b.Checked).Enabled=1<0;}else a.All(b=>b.Enabled=0<1);};p.Controls.Add(c);return c;}).ToArray();Application.Run(p);}}

@Johnbot Thanks! Never would have thought of most of that. Heck, I forgot object initialisers existed!

364 if you use the conditional operator in place of the if statement. Replace if(a.Count(b=>b.Checked)>1){a.First(b=>!b.Checked).Enabled=1<0;}else a.All(b=>b.Enabled=0<1); with a.First(b=>!b.Checked).Enabled=a.Count(b=>b.Checked)>1?1<0:a.All(b=>b.Enabled=0<1);

PHP, Javascript, jQuery - 135b
I was admiring @nderscore's answer, but then I decided to copy and one-up him.
<?echo"SELECT ANY TWO".($m="<input type=checkbox onclick=(a=$('input:not(:checked)')).prop('disabled',!a[1])>")."FAST$m GOOD$m CHEAP"?>

Basically I replaced his .join trick with some PHP Hypertext Preprocessing.

When you consider that 27 bytes are required for the text "resources" in the program, this is getting very close to a 100b program. Well done!

I'm not much of a PHP golfer, but I chopped a few bytes off for you: (128) SELECT ANY TWO<?=($m="<input type=checkbox onclick=(a=$('input:not(:checked)')).prop('disabled',!a[1])>").FAST.$m.GOOD.$m.CHEAP;

Ruby, 219 218 bytes
I use the same Tk widgets as the Python 3 answer by Quincunx.
This program breaks the rules because it has a check box list. (The rules said, "Don't use a check box list.") Yes, a is an array of 3 TkCheckButton objects, and I believe that an array is a list. My defense is that I did not use any existing check box list, but I used the standard check boxes and made my own list.
require'tk'
o=->(c){c.variable.value>?0}
TkLabel.new{text'SELECT ANY TWO'
pack}
a=%w[FAST CHEAP GOOD].map{|t|TkCheckButton.new{text t
command{a.map{|c|c.state a.count(&o)<2||o[c]?:normal: :disabled}}
pack}}
Tk.mainloop

I tested with Ruby 2.1.0 and Tk 8.5.15.

o[c] is a predicate to test if check button c is selected. With the default strings, c.variable.value is '0' or '1', so the string comparison is only true if '1'>'0'. EDIT: I saved 1 byte (219 down to 218) by changing '0' to ?0. In Ruby, ?0 is a character constant.
a.count(&o) uses the predicate to count the selected check buttons.
When the user toggles a check button, the command calls a.map to loop for all buttons, making them :normal or :disabled.

Very good. No rule breaking here - I was referring to a check box list control that may happen to be part of the language framework. I believe all of the answers so far use some kind of map or selector, so this is totally legit.

AngularJS - 214
<input type=checkbox ng-model=fast ng-disabled=cheap&&good>FAST</input>
<input type=checkbox ng-model=cheap ng-disabled=fast&&good>CHEAP</input>
<input type=checkbox ng-model=good ng-disabled=fast&&cheap>GOOD</input>

I tried this out at JSFiddle, but without any success. Can you provide a working example?

http://plnkr.co/edit/Y1FQOQyGJXlC9r3Rk2Zr?p=preview

You did not mention "ng-app". Check  in my example.

Ah, OK :-)  You can golf it down a bit by removing the quotation marks and extra line breaks.

Mathematica
A more code-golfed version as suggested by David, 255 characters:
h = Checkbox;
i = Dynamic;
j = Enabled;
t = True;
i[
 If[Total@Boole@{a, b, c} == 2,
  {d, e, f} = {a, b, c},
  {d, e, f} = {t, t, t}
  ];
 Row@{
   "SELECT ANY TWO",
   h[i@a, j -> d], "FAST",
   h[i@b, j -> e], "CHEAP",
   h[i@c, j -> f], "GOOD"
   }
 ]

You can save some characters by using h=Checkbox;i=Dynamic;j=Enabled.

@DavidCarraher Thanks, I can see myself using that technique for other code golfing question in the future as well.

No need to include both versions. And don't forget to use h and to adjust your char count in the heading.

JavaScript (with jQuery) - 224, 222, 210, 205, 178
a="<input type=checkbox>",c=":checked",e="input",f="disabled",d=$("body").html("SELECT ANY TWO"+a+" FAST"+a+"CHEAP"+a+"GOOD").click(function(){$(e).not(c).attr(f,$(e+c).length>1)})

Thanks to a comment from brilliant @Matt I reduced the code by 27 characters.
JSFiddle

Save 25 or so by moving your condition $(e+c).length>1 into the assignment as such: $(e).not(c).attr(f,$(e+c).length>1) since you're only changing the boolean itself.

Managed to get it down to 169 using a mix of yours and mine. The !! coercion and a little extra golfing with not assigning body to d. a="<input type=checkbox>",c=":checked",e="input";$("body").html("SELECT ANY TWO"+a+"FAST"+a+"CHEAP"+a+"GOOD").click(function(){$(e).not(c).attr("disabled",!!$(e+c)[1])})

k3 - 95
a[`FAST`CHEAP`GOOD]:0
a[.;`c]:`check
a..l:"SELECT ANY TWO"
a..t:"if[3=+/a[];.[_v;_i;:;0]]"
`show$`a

code is here

(source: nsl.com)

line 1: a dictionary with three variables; line 2: each variable is a checkbutton; line 3: label the dictionary; line 4: if three variables have been checked, reset the last variable checked to 0; line 5: show the dictionary.

Nice! Such a tragedy k4 has no GUI...

k wins (but oh irony! 9 more characters are required in order to post!)

C#, 335 333 326 320 308
Based off Bobs Answer, mine does use fewer characters than his (335 v 342), but I might not understand fully how to count this.
using System.Linq;using System.Windows.Forms;class P:Form{static void Main(){new P();}P(){Text="SELECT ANY TWO";var a="FAST CHEAP GOOD".Split().Select(r=>new CheckBox{Text=r,Top=r[0]%9*20}).ToList();a.All(r=>{r.Validating+=(b,c)=>c.Cancel=a.Count(z=>z.Checked)>1;Controls.Add(r);return 1>0;});ShowDialog();}}

Ungolfed
using System.Linq;
using System.Windows.Forms;

class P : Form
{
    static void Main()
    {
        new P();
    }

    P()
    {
        Text = "SELECT ANY TWO";

        var a = "FAST CHEAP GOOD".Split().Select(r => new CheckBox
        {
            Text = r,
            Top = r[0] % 9 * 20
        }).ToList();

        //loops, I dont need no stinking loops
        a.All(r => { r.Validating += (b, c) => c.Cancel = a.Count(z => z.Checked) > 1; Controls.Add(r); return 1 > 0; });
        ShowDialog();
    }
}

Great use of anon functions and Linq here, especially like the Select.

You can save a couple more characters by replacing the ==2 with a >1, and the true with a 1>0. You can also use a All instead of Where and Last. ToList is also shorter than ToArray.

@Bob Good call, don't know how I missed All(), and as a bonus, turns out with All you don't have to materialize it, saving even more

Groovy - 357 221 217 chars
I've ported Quincunx's solution to Groovy 2.2.1, using SwingBuilder (and made it even more Groovier):
c=[];new groovy.swing.SwingBuilder().frame(){panel(){label("SELECT ANY TWO");f={if(c.count{it.isSelected()}>2)it.source.setSelected(1<0)};["FAST","CHEAP","GOOD"].each{c<<checkBox(label:it,itemStateChanged:f)}}}.show()

Ungolfed:
c=[]
new groovy.swing.SwingBuilder().frame() {
    panel() {
        label("SELECT ANY TWO")
        f = { if (c.count{it.isSelected()} > 2) it.source.setSelected(1<0) }
        ["FAST","CHEAP","GOOD"].each { c << checkBox(label: it, itemStateChanged: f) }
    }
}.show()

mIRC script (727 719 bytes)
Forgot about this language until a drunken conversation last night.
alias select_two {
  dialog -m s2 s2
}

dialog s2 {
  title "Select any two:"
  size -1 -1 200 100
  check "Fast",1, 5 10 170 25
  check "Cheap",2, 5 30 170 25
  check "Good",3, 5 50 170 25
}

on *:dialog:s2:sclick:*: {
  if ($did(s2, $did).state = 1) {
    if ($did = 1) {
      if ($did(s2, 2).state = 1) { did -b s2 3 }
      if ($did(s2, 3).state = 1) { did -b s2 2 }
    }
    if ($did = 2) {
      if ($did(s2, 1).state = 1) { did -b s2 3 }
      if ($did(s2, 3).state = 1) { did -b s2 1 }
    }
    if ($did = 3) {
      if ($did(s2, 1).state = 1) { did -b s2 2 }
      if ($did(s2, 2).state = 1) { did -b s2 1 }
    }
  }
  if ($did(s2, $did).state = 0) {
    did -e s2 1
    did -e s2 2
    did -e s2 3
  }
}

More should be coded in this language! But there needs to be a way to make this into a real mess so it can be as good as Perl.
Edit: noticed that my Python-isms are leaking through and was able to reduce the code by 8 bytes!

Haha, I like the intro to this one. It's kind of verbose though - could it be the beer speaking? =c)

QML - 369 315 254 251 248 bytes
Here goes QML (QtQuick 2.0) version, given only the .qml file contents. This code requires Qt 5.1 at least to run. Not a big deal as its huge compared to other solutions (248 bytes), but it's a full featured cross-platform application (Android and iOs included)! :D
    import QtQuick 2.0;import QtQuick.Controls 1.1;Row{Text{text:"SELECT ANY TWO"}CheckBox{id:a;text:"FAST";enabled:!b.checked|!c.checked}CheckBox{id:b;text:"CHEAP";enabled:!a.checked|!c.checked}CheckBox{id:c;text:"GOOD";enabled:!b.checked|!a.checked}}

To run it, save the code to a .qml file, install Qt 5.1 and run qmlscene.exe (or just qmlscene on linux), which will show an open file dialog. Chose the .qml file you've saved the code to and see the awesome result! :D

JavaScript 209 (was 346)
Shortened: thanks for comments.
function f(){var a=document.getElementsByClassName("x"),n=0,i=0;for(i in a){if(a[i].checked)n++;}if(n<2){for(i in a){a[i].disabled=false;}}else{for(i in a){i(false===a[i].checked){a[i].disabled=true;break;}}}}

Golfed function:
function f(a,b,c){
var x=document.getElementById(a);
var y=document.getElementById(b);
var z=document.getElementById(c);
var n=0,i=0;
var a=[x,y,z];
for(i in a)
{
if(a[i].checked) n++;
}
if(n<2)
{
for(i in a)
{
a[i].disabled=false;
}
}
else
{
for(i in a)
{
if(false===a[i].checked)
{
a[i].disabled=true;
break;
}
}
}
}

HTML form: provides input and calls the function.
* Form now uses class=x to group inputs.
<form>
        SELECT ANY TWO<br>
        FAST <input id="a" type="checkbox" class="x" value="0" onchange="f()"><br>
        CHEAP <input id="b" type="checkbox" class="x" value="1" onchange="f()"><br>
        GOOD <input id="c" type="checkbox" class="x" value="2" onchange="f()"><br>
    </form>

Tested with NetBeans and Chrome.

You can golf the function further and reduce it to 264 characters by consolidating all of your vars, removing unnecessary braces and whitespace (including newline chars). You could probably get it smaller if you use an ES6 lambda.

Apart from some more obvious golfing, consider using a class to pull all of the input elements into an array in one hit instead, using getElementsByClassName eg. a=document.getElementsByClassName('q').

change the ids to name and just call them with document.a, document.c, document.c also put them directly into a[]

JavaScript / jQuery 237 234 229
Very similar approach as Matt's answer, although a little longer.
$(function(){var e="input ",t="disabled",n,r;$("body").html("SELECT ANY TWO|FAST|CHEAP|GOOD".replace(/\|/g,"<"+e+'type="checkbox">'));n=$(e);n.change(function(){n.removeAttr(t);r=$(":checked");if(r.length>1)n.not(r).attr(t,t)})})

Groovy
Based on the Java version, but much slimmed down ;)
Types were replaced by 'def', semicolons removed, add replaced by <<, the 1<0 replaced by 0, collect for creating the checkboxes, removed the itemevent type, removed casting the checkbox, enhanced the loops.
import java.awt.*
class F {
    def static main(a) {
        def f = new Frame()
        def p = new Panel()
        f << p
        p << new Label("SELECT ANY TWO")
        def c = ['FAST','CHECK','GOOD'].collect { new Checkbox(it) }
        c.each { b ->
            p << b
            b.addItemListener { e->
                int x = 0, i = 0
                3.times {
                    x += c[it].state ? 1 : 0
                }
                if (x > 2) {
                    e.source.state = 0
                }
            }
        }
        f.show()
    }
}

Groovy is not java. That means that all those enhancements don't count as much. Everything you removed was necessary in java, but not groovy.

You're right, Groovy is not Java, that why it's called Groovy. I'm not sure what you're trying to say here.

TCL 347
At least it beats Python and Java.
set d .
proc a v {upvar f f c c g g d d $v x
if $x&&$f+$c+$g==2 {set d .$f$c$g
$d configure -state disabled}
if !$x {$d configure -state normal}}
set z -variable
set y -command
set x checkbutton
label .l -text {SELECT ANY TWO}
$x .011 -text FAST $z f $y a\ f
$x .101 -text CHEAP $z c $y a\ c
$x .110 -text GOOD $z g $y a\ g
pack .l .011 .101 .110

Note: if you start by selecting one checkbox and immediately unselecting it, you will get an error. You can fix it by adding 110 to the end of the first line.
Ungolfed:
# Keep track of the last disabled button. Set it to something valid to start with.
set last .110

proc toggled name {
        # Access some globals
        upvar fast  fast
        upvar cheap cheap
        upvar good  good
        upvar last  last
        upvar $name value

        # Just toggled one on, check if exactly two are now on
        if {$value == 1 && ($fast + $cheap + $good) == 2} {
                set last .$fast$cheap$good
                $last configure -state disabled
        }
        # Just toggled one off. Re-enable disabled one.
        if {$value == 0} {
                $last configure -state normal
        }
}

label .label -text {SELECT ANY TWO}

checkbutton .011 -text FAST  -variable fast  -command {toggled fast}
checkbutton .101 -text CHEAP -variable cheap -command {toggled cheap}
checkbutton .110 -text GOOD  -variable good  -command {toggled good}

pack .label .011 .101 .110

Javascript + Knockout: ~250 Characters
a=function(i){return "<input type=checkbox data-bind='value: "+i+", checked: x, disable: x().length>=2 && x().indexOf(\""+i+"\")==-1'>"},document.body.innerHTML = "SELECT ANY TWO"+a(0)+"Fast"+a(1)+"Good"+a(2)+"Cheap"; ko.applyBindings({x:ko.observableArray([])})

Fiddle

AngularJS - 155 (Demo)
SELECT ANY TWO :<i ng-init=t=[]><p ng-repeat="(i,v) in ['FAST','CHEAP','GOOD']"><input type=checkbox ng-disabled=t[(i+1)%3]&&t[(i+2)%3] ng-model=t[i]>{{v}}

The ungolfed version:
SELECT ANY TWO :
<i ng-init="checkedArray = []" /> <!-- A useless tag to initialize the array (which can't be done on the `input` tag, unfortunately) -->
<p ng-repeat="(key, value) in ['FAST', 'CHEAP', 'GOOD']">
    <input
        type="checkbox"
        ng-model="checkedArray[key]"
        ng-disabled="checkedArray[(key + 1) % 3] && checkedArray[(key + 2) % 3]"
    />
    {{value}}
</p>

Ruby with Shoes, 133 characters
Shoes.app{para'SELECT ANY TWO'
$o=%w{FAST GOOD CHEAP}.map{|q|c=check{|c|$o[c]=!$o[c];$o.values.all?&&c.checked=p}
para q
[c,p]}.to_h}

Sample output:

FLTK, 303 characters
decl{int c;}Function{}{}{Fl_Window{}{xywh {9 9 195 195}}{Fl_Pack{}{label{SELECT ANY TWO}}{Fl_Check_Button{}{callback{e(o);}label FAST}Fl_Check_Button{}{callback{e(o);}label GOOD}Fl_Check_Button{}{callback{e(o);}label CHEAP}}}}Function{e(Fl_Button*o)}{}{code{if((c+=o->value()*2-1)>2){o->value(0);c--;}}}

Ungolfed:
decl { int c; }

Function {} {} {
    Fl_Window {} {
        xywh {9 9 195 195}
    } {
        Fl_Pack {} {
            label {SELECT ANY TWO}
        } {
            Fl_Check_Button {} {
                callback { e(o); }
                label FAST
            }
            Fl_Check_Button {} {
                callback { e(o); }
                label GOOD
            }
            Fl_Check_Button {} {
                callback { e(o); }
                label CHEAP
            }
        }
    }
}

Function { e(Fl_Button* o) } {} {
    code {
        if ((c += o->value() * 2 - 1) > 2) {
            o->value(0);
            c--;
        }
    }
}

Sample output:


text:
X greater than 3 with at least 2 difference between X and Y
I am trying to golf down some C++. Is it possible to make this condition shorter?
X > 3 & X - Y > 1
(Apart from removing whitespace, of course.)
So, X is at least 4 but X >= Y + 2.
X and Y are integers in the [0,5] interval.
I have tried to find some bitwise formula but failed.

It's.... pretty short already.

Yeah, but the problem is that I use this condition (only with variable names changed) in more places, so they add up. I think there can be a formula for this condition, noting that they are in [0,5] interval, but can't see it.

If you use it often and don't want to type it out each time, use a function?

I used it like 4 times, so that is 36 characters. Creating a function + calling it will be longer.

It's generally not a good idea to use & for logical operations.

@JoeZ. For CodeGolf? Why? As long as it is working...

Guys, what's with the close votes? This is not a general programming question? This is about advice for code golfing. (@Cristy you may want to make that clearer in the question though, before the question does get closed and starts amassing downvotes.)

@Cristy I took the liberty to do that as the close-votes keep coming in. Feel free to rephrase my edit.

Oh, I assumed that all the questions on codegolf.se.com are about codegolf, lol :D

@Cristy yes they are, but (so far) questions asking about golfing advice are very rare whereas most questions asking for advice are indeed just general programming questions - which are off-topic. Hence, I can understand why the first reaction of people might be, "oh that's another question that actually belongs on SO", without even thinking it could be about golfing advice. I'd actually like to see more of these in the future, and maybe there'll be a tag for them some day or so, and it will be clear immediately that you know how to use this site. ;)

@m.buettner I tend to agree that this kind of code-golf advice question is possibly a good fit for this site.  Of course the tagging would need to be sorted out - perhaps [tag:advice] or something like that.  Do you want to take this to meta?

@DigitalTrauma I want to and will (later tonight or tomorrow)

@m.buettner http://meta.codegolf.stackexchange.com/questions/1470/re-evaluating-tips-and-tip-like-questions

(/cc @DigitalTrauma, see above comment)

@Doorknob yep, I'm aware of that question. Already considering whether my post will be an answer to it or a new question (referencing yours). ;) Depends on whether my actual post will be more of a question or answer I suppose. ^^

Just to be sure: When you say that “X and Y range in the [0,5] interval.”, this means that they are floats?

If they are integers between 0..5 inclusive, you can do the same thing with x*x-y*y>9. It's the same amount of characters, but you may be able to find a shortcut/alternative to that approach. Just another way of looking at it.

@Wrzlprmft They are integers.

Use Python: 3<x>y+1

I tried to prove mathematically that this cannot be improved, but didn't quite manage to :) (The general idea was that you need at least one asymmetrical operation, as well as at least one comparison operator and one number... and I just can't see a way to pull that off in C++ under 9 characters)

Ppl, stop trying to close this topic. It's not an OT because it is about Codegolf. It isn't a programming problem to solve but to golf a problem. It is 100% valid question.

I guess what you mentioned is optimal solution since there are - two checks and
- involves two variables

I found a lot of solutions with Python's operator precedence, e.g. y+3<2^x, but C's operator precedence is different. I'm betting there's a 7-char solution, just have to modify my script to deal with C operator precedence instead

This solution is longer, but seems interesting:
(x&4)>>(y^x&1)

I can only match the length, but can't come up with anything shorter. My solution is x>3+y*y/7 for what it is worth (not much).

After brute forcing every useful combination of symbols under 9 characters, I've found there to be no smaller solution than x>3&x-y>1.
For fun here's some funky 9 character solutions the brute forcer found:
-x<~y>4>x
~y+x>2>>y
x*x-y*y>9
~y>x/~3*x
-3>>y>y-x
~y+x<<y>2

Brute forcing was done in Python, building top-down syntax trees where no child may have an operator with precedence lower than its parent according to C's rules. To cut down on possibilities I only allowed single digit literals, and no binary operator may have two constant children. I could not possibly think of any solution that would have a two digit literal, or one that builds a constant using a binary operator. Then each expression was evaluated for [0, 5] and if it matches it gets printed.

I really like x*x-y*y>9. Perhaps you should try multi-digit constants as well? (also, parentheses)

@JanDvorak me too. It expresses well the logic of "distance between x and y". I think if you plot this in a chart, it would become more obvious.

@JanDvorak I don't think parentheses can ever be a smaller solution. A smaller solution can be a max of 8 characters, of which 2 must be xy, and 2 must be the parentheses, leaving only 4 characters of logic. I'll try running the brute forcer with 2 digit constants, but I really don't think it'll give a result.

How about, x, y, a constant, a pair of parentheses and two operators?

@JanDvorak Knock yourself out, (a#b)$c is the format. Out of abc two must be x and y, leaving 3 possible locations for [0-9xy], and only one flip of xy. Only interesting operators are +-*/&|^<>, so 9 possibilities. Thus total possibilities is less than 312299 < 5832.

@JanDvorak do you think you can get smaller than 7 characters? I've just written a bit of a critique. I admit I'm not a golf.SE regular, so I might not be in the target audience. I do think my answer contributes important (data) points, though

@JanDvorak No possible expressions with double digit literals.

In response to the (awesome) golfs by orlp:
Correctness must come first

Most of these break down for some integer types. This includes the version from the OP
Interestingly they do work for int16_t - so there is the assumption. Probably the bit shifts would need to +16 for 32 bit ints (that's pretty much everywhere these days). This makes them a character bigger...

The only "correct" way to write it, IMO is (x>3) && (x > y+1), which may be golfed down to x>3&x>y+1 (9 characters).
(You really need to take the possibility of (larger) unsigned types into consideration, especially since unsigned-ness is "contagious" in C++ expressions. I suppose "fixing" that with the appropriate static_cast<>s would kinda defeat the purpose...)
UPDATE
With the following tests I've been able to figure out which expressions actually work reliably:
Live On Coliru
#define REPORT(caption, expr) do {\
    do_report(caption, [](T x, T y) -> bool { return (expr); }, #expr); } while (false)

template <typename T> struct driver {
    static void run() {
        std::cout << "\n" << __PRETTY_FUNCTION__ << "\n";

        // the only two correct implementations:
        REPORT("MASTER"  , (x>3) && (x>y+1));
        REPORT("GOLF"    , x>3&x>y+1);
        REPORT("lookup"  , "000000000000000000000000111000111100"[x*6+y]-'0');

        // failing sometimes:
        REPORT("question", (x>3)&(x-y>1));
        REPORT("orlp0"   , x>3&x-y>1);
        REPORT("orlp2"   , ~y+x>2>>y);
        REPORT("orlp3"   , x*x-y*y>9);
        REPORT("orlp4"   , ~y>x/~3*x);
        REPORT("orlp5"   , -3>>y>y-x);
        REPORT("orlp6"   , ~y+x<<y>2);

        // failing always
        REPORT("orlp1"   , -x<~y>4>x);
    }
private:
    static void do_report(std::string const& caption, bool (*f)(T,T), char const* expression) {
        std::string r;
        for (T x = 0; x < 6; ++x) for (T y = 0; y < 6; ++y) r += f(x, y)?'1':'0';
        bool const correct = "000000000000000000000000111000111100" == r;
        std::cout << (correct?"OK\t":"ERR\t") << r << "\t" << caption << "\t" << expression << "\n";
    }
};

int main() {
    driver<int8_t>::run();
    driver<int16_t>::run();
    driver<int32_t>::run();
    driver<int64_t>::run();

    driver<uint8_t>::run();
    driver<uint16_t>::run();
    driver<uint32_t>::run();
    driver<uint64_t>::run();
}

Output on coliru, here for reference:
static void driver<T>::run() [with T = signed char]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
OK  000000000000000000000000111000111100    question    (x>3)&(x-y>1)
OK  000000000000000000000000111000111100    orlp0   x>3&x-y>1
OK  000000000000000000000000111000111100    orlp2   ~y+x>2>>y
OK  000000000000000000000000111000111100    orlp3   x*x-y*y>9
OK  000000000000000000000000111000111100    orlp4   ~y>x/~3*x
OK  000000000000000000000000111000111100    orlp5   -3>>y>y-x
OK  000000000000000000000000111000111100    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = short int]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
OK  000000000000000000000000111000111100    question    (x>3)&(x-y>1)
OK  000000000000000000000000111000111100    orlp0   x>3&x-y>1
OK  000000000000000000000000111000111100    orlp2   ~y+x>2>>y
OK  000000000000000000000000111000111100    orlp3   x*x-y*y>9
OK  000000000000000000000000111000111100    orlp4   ~y>x/~3*x
OK  000000000000000000000000111000111100    orlp5   -3>>y>y-x
OK  000000000000000000000000111000111100    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = int]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
OK  000000000000000000000000111000111100    question    (x>3)&(x-y>1)
OK  000000000000000000000000111000111100    orlp0   x>3&x-y>1
OK  000000000000000000000000111000111100    orlp2   ~y+x>2>>y
OK  000000000000000000000000111000111100    orlp3   x*x-y*y>9
OK  000000000000000000000000111000111100    orlp4   ~y>x/~3*x
OK  000000000000000000000000111000111100    orlp5   -3>>y>y-x
OK  000000000000000000000000111000111100    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = long int]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
OK  000000000000000000000000111000111100    question    (x>3)&(x-y>1)
OK  000000000000000000000000111000111100    orlp0   x>3&x-y>1
OK  000000000000000000000000111000111100    orlp2   ~y+x>2>>y
OK  000000000000000000000000111000111100    orlp3   x*x-y*y>9
OK  000000000000000000000000111000111100    orlp4   ~y>x/~3*x
OK  000000000000000000000000111000111100    orlp5   -3>>y>y-x
OK  000000000000000000000000111000111100    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = unsigned char]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
OK  000000000000000000000000111000111100    question    (x>3)&(x-y>1)
OK  000000000000000000000000111000111100    orlp0   x>3&x-y>1
OK  000000000000000000000000111000111100    orlp2   ~y+x>2>>y
OK  000000000000000000000000111000111100    orlp3   x*x-y*y>9
OK  000000000000000000000000111000111100    orlp4   ~y>x/~3*x
OK  000000000000000000000000111000111100    orlp5   -3>>y>y-x
OK  000000000000000000000000111000111100    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = short unsigned int]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
OK  000000000000000000000000111000111100    question    (x>3)&(x-y>1)
OK  000000000000000000000000111000111100    orlp0   x>3&x-y>1
OK  000000000000000000000000111000111100    orlp2   ~y+x>2>>y
OK  000000000000000000000000111000111100    orlp3   x*x-y*y>9
OK  000000000000000000000000111000111100    orlp4   ~y>x/~3*x
OK  000000000000000000000000111000111100    orlp5   -3>>y>y-x
OK  000000000000000000000000111000111100    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = unsigned int]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
ERR 000000000000000000000000111001111100    question    (x>3)&(x-y>1)
ERR 000000000000000000000000111001111100    orlp0   x>3&x-y>1
ERR 111111011111001111000111111011111101    orlp2   ~y+x>2>>y
ERR 011111001111000111000011111001111100    orlp3   x*x-y*y>9
ERR 111111111111111111111111111111111111    orlp4   ~y>x/~3*x
ERR 111111011111001111000111111011111101    orlp5   -3>>y>y-x
ERR 111111011111001111000111111011111101    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

static void driver<T>::run() [with T = long unsigned int]
OK  000000000000000000000000111000111100    MASTER  (x>3) && (x>y+1)
OK  000000000000000000000000111000111100    GOLF    x>3&x>y+1
OK  000000000000000000000000111000111100    lookup  "000000000000000000000000111000111100"[x*6+y]-'0'
ERR 000000000000000000000000111001111100    question    (x>3)&(x-y>1)
ERR 000000000000000000000000111001111100    orlp0   x>3&x-y>1
ERR 111111011111001111000111111011111101    orlp2   ~y+x>2>>y
ERR 011111001111000111000011111001111100    orlp3   x*x-y*y>9
ERR 111111111111111111111111111111111111    orlp4   ~y>x/~3*x
ERR 111111011111001111000111111011111101    orlp5   -3>>y>y-x
ERR 111111011111001111000111111011111101    orlp6   ~y+x<<y>2
ERR 000000000000000000000000000000000000    orlp1   -x<~y>4>x

Summary
Since this about the "cost" of repeating source code elements, you might use a lookup table. You can "hide" the lookup table, so it is either
 LUT[x][y]

or
 LUT[x*6+y]

Of course you can be pedantic and obtuse and rename the LUT
 L[x][y]

So my "version" is ... 7 characters. (Or make if a function and L(x,y) is even shorter).
Or, more importantly: correct, testable and maintainable.

Added a "true" golf. No shorter than 9 characters, but the first one to be correct!

source: Stack Exchange

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

sort: votes


text:
Dither a Grayscale Image
Dither a grayscale image into pure black and white with your own algorithm.
Guidelines: You must come up with your own new algorithm. You cannot use pre-existing algorithms (ex. Floyd-Steinburg) but you can use the general technique. Your program must be able to read an image and produce an image the same size. This is a popularity contest, so whoever produces the best (closest to original) and most creative (determined by votes) wins. Bonus if the code is short, though this is not necessary.
You can use whatever grayscale image you want as input, it should be larger than 300x300. Any file format is fine.
Example input:

Example output:

This is a pretty good job, but there still are visible lines and patterns.

Hm. Without any restriction on the code what prevents people from just implementing some established algorithm that is known to give "the best" results?

@m.buettner I thought about this but I couldn't come up with a good solution. I don't want to do byte count, because that would give some languages a large advantage. Maybe speed and memory usage.

+1 for an interesting challenge, but I think this would be much better as a [code-golf] (with a spec) or some other completely objective criterion.

The problem with code-size, speed and memory usage is that you'd need an objective threshold for how recognisable the result must be for the answer to be valid, which is also quite impossible. Popularity contest does make sense, but without any restriction on the code there is no incentive for people to think out of the box. I'd rather upvote a clever answer than one gives the best result because it just implemented an existing algorithm. But you are currently incentivising the latter.

@m.buettner I've edited the criteria so a new algorithm has to be made and creativity is taken into account. This doesn't stop people from slightly modifying an existing algorithm, but I hope it encourages creativity (every realistic way to dither has already been developed)

As a reference, a simple mean threshold of this image is here. Technically, that counts as dithering, according to Wikipedia.

The line between an algorithm and its technique is too thin to determine which side something falls.

I think it would be a lot easier to compare the results if they all showed results from the same image.

@Doorknob I disagree. Image quality is, by definition, subjective. If you put a code-golf tag on this, you will end up with a load of answers giving 50% black/white threshold. It's a rare example of correct application of the popularity-contest tag (i.e, when there is no way of judging objectively.)

@steveverrill By "with a spec" I mean "with an exact specification of what the output should be, i.e. every solution produces the same output."

@Doorknob defining the output would be both difficult and limiting. Much of what makes image processing interesting is that you try an algorithm and you have no idea if it's going to be any good until you see the results. Remember this question? Very broad, 182 upvotes, no downvotes. If every question had a tight spec we would never have seen this. http://codegolf.stackexchange.com/q/22144/15599

Can you add the source of the image? (I don't think someone will be angry to see its his/her image here, but it's fair to cite the source)

@A.L I was hoping to see an answer to this.  I've done some searching and found that it was a popular "wallpaper" distributed since about 2007 by "Crazy-Frankenstein.com", and I found a copy in a blog archive of June 2005 http://valentinedayisu.blogspot.com/2005/06/canine-wallpaper.html, without the craxy-frankenstein watermark.

Fortran
Okay, I'm using an obscure image format called FITS which is used for astronomy. This means there is a Fortran library for reading and writing such images. Also, ImageMagick and Gimp can both read/write FITS images.
The algorithm I use is based on "Sierra Lite" dithering, but with two improvements:
a) I reduce the propagated error by a factor 4/5.
b) I introduce a random variation in the diffusion matrix while keeping its sum constant.
Together these almost completely elminiate the patterns seen in OPs example.
Assuming you have the CFITSIO library installed, compile with

gfortran -lcfitsio dither.f90

The file names are hard-coded (couldn't be bothered to fix this).
Code:
program dither
  integer              :: status,unit,readwrite,blocksize,naxes(2),nfound
  integer              :: group,npixels,bitpix,naxis,i,j,fpixel,un
  real                 :: nullval,diff_mat(3,2),perr
  real, allocatable    :: image(:,:), error(:,:)
  integer, allocatable :: seed(:)
  logical              :: anynull,simple,extend
  character(len=80)    :: filename

  call random_seed(size=Nrand)
  allocate(seed(Nrand))
  open(newunit=un,file="/dev/urandom",access="stream",&
       form="unformatted",action="read",status="old")
  read(un) seed
  close(un)
  call random_seed(put=seed)
  deallocate(seed)

  status=0
  call ftgiou(unit,status)
  filename='PUPPY.FITS'
  readwrite=0
  call ftopen(unit,filename,readwrite,blocksize,status)
  call ftgknj(unit,'NAXIS',1,2,naxes,nfound,status)
  call ftgidt(unit,bitpix,status)
  npixels=naxes(1)*naxes(2)
  group=1
  nullval=-999
  allocate(image(naxes(1),naxes(2)))
  allocate(error(naxes(1)+1,naxes(2)+1))
  call ftgpve(unit,group,1,npixels,nullval,image,anynull,status)
  call ftclos(unit, status)
  call ftfiou(unit, status)

  diff_mat=0.0
  diff_mat(3,1) = 2.0
  diff_mat(1,2) = 1.0
  diff_mat(2,2) = 1.0
  diff_mat=diff_mat/5.0

  error=0.0
  perr=0
  do j=1,naxes(2)
    do i=1,naxes(1)
      p=max(min(image(i,j)+error(i,j),255.0),0.0)
      if (p < 127.0) then
        perr=p
        image(i,j)=0.0
      else
        perr=p-255.0
        image(i,j)=255.0
      endif
      call random_number(r)
      r=0.6*(r-0.5)
      error(i+1,j)=  error(i+1,j)  +perr*(diff_mat(3,1)+r)
      error(i-1,j+1)=error(i-1,j+1)+perr*diff_mat(1,2)
      error(i  ,j+1)=error(i ,j+1) +perr*(diff_mat(2,2)-r)
    end do
  end do

  call ftgiou(unit,status)
  blocksize=1
  filename='PUPPY-OUT.FITS'
  call ftinit(unit,filename,blocksize,status)
  simple=.true.
  naxis=2
  extend=.true.
  call ftphpr(unit,simple,bitpix,naxis,naxes,0,1,extend,status)
  group=1
  fpixel=1
  call ftppre(unit,group,fpixel,npixels,image,status)
  call ftclos(unit, status)
  call ftfiou(unit, status)

  deallocate(image)
  deallocate(error)
end program dither

Example output for the puppy image in OPs post:

OPs example output:

This looks really good, might be unbeatable for quality

Thanks! I don't know that it's unbeatable, but it's going to be hard (very subjective) to judge this against other good algorithms.

I know I golf code by abusing backwards compatibility, but it actually looks like you abuse it as standard. This code is actually making me cry.

@KyleKanos I'm always happy when my code makes someone cry :p On topic though, what specifically is horrible here?
Yes, I could've used "implicit none", but where's the fun in that? I do use it for serious coding at work, but not for golfing. And I definitely agree that the CFITSIO library API is completely horrible (ftppre() outputs a FITS image in single real precision, ftpprj() outputs an image in double integer precision, etc.) but that's F77 backwards compatibility for you.

I should also add: I used "diff_mat(3,1)" etc. instead of just putting the coefficients inside the loop because I wanted the algorithm to be easier to spot.

Character with * notation instead of len=###, sparing use of :: in variable declaration, lack of program /end program, & general indentation. What the code does is awesome, though.

Okay, so most of those were just me being sloppy. I improved it. Constructive criticism is always appreciated :)

GraphicsMagick/ImageMagick
Ordered Dither:
magick B2DBy.jpg -gamma .45455 -ordered-dither [all] 4x4 ordered4x4g45.pbm

Before complaining about my using an "established algorithm" please read the ChangeLog for GraphicsMagick and ImageMagick for April 2003 where you'll see that I implemented the algorithm in those applications.  Also, the combination of "-gamma .45455" with "-ordered-dither" is new.
The "-gamma .45455" takes care of the image being too light.  The "all" parameter is only needed with GraphicsMagick.
There's banding because there are only 17 graylevels in a 4x4 ordered-dither image.
The appearance of banding can be reduced by using an 8x8 ordered-dither which has 65 levels.
Here are the original image, the 4x4 and 8x8 ordered dithered output and the random-threshold output:

I prefer the ordered-dither version, but am including the random-threshold version for completeness.
magick B2DBy.jpg -gamma .6 -random-threshold 10x90% random-threshold.pbm

The "10x90%" means to render below 10 percent intensity pixels as pure black and above 90 percent as pure white, to avoid having a few lonely specks in those areas.
It's probably worth noting that both are as memory-efficient as they can possibly be.  Neither does any diffusion, so they work one pixel at a time, even when writing ordered-dither blocks, and don't need to know anything about the neighboring pixels.  ImageMagick and GraphicsMagick process a row at a time, but it's not necessary for these methods.  The ordered-dither conversions take less than .04 second real time on my old x86_64 computer.

"Before complaining about my using an "established algorithm" please read the ChangeLog for GraphicsMagick and ImageMagick for April 2003 where you'll see that I implemented the algorithm in those applications." +1 for sheer cheek.

I apologize for the code style, I threw this together using some libraries we just built in my java class, and it has a bad case of copy-paste and magic numbers. The algorithm picks random rectangles in the image, and checks if the average brightness is greater in the dithered image or the original image. It then turns a pixel on or off to bring the brightnesses closer in line, preferentially picking pixels that are more different from the original image. I think it does a better job bringing out thin details like the puppy's hair, but the image is noisier because it tries to bring out details even in areas with none.

public void dither(){
    int count = 0;
    ditheredFrame.suspendNotifications();
    while(count < 1000000){
        count ++;
        int widthw = 5+r.nextInt(5);
        int heightw = widthw;
        int minx = r.nextInt(width-widthw);
        int miny = r.nextInt(height-heightw);

            Frame targetCropped = targetFrame.crop(minx, miny, widthw, heightw);
            Frame ditherCropped = ditheredFrame.crop(minx, miny, widthw, heightw);

            if(targetCropped.getAverage().getBrightness() > ditherCropped.getAverage().getBrightness() ){
                int x = 0;
                int y = 0;
                double diff = 0;

                for(int i = 1; i < ditherCropped.getWidth()-1; i ++){
                    for(int j = 1; j < ditherCropped.getHeight()-1; j ++){
                        double d = targetCropped.getPixel(i,  j).getBrightness() - ditherCropped.getPixel(i, j).getBrightness();
                        d += .005* targetCropped.getPixel(i+1,  j).getBrightness() - .005*ditherCropped.getPixel(i+1, j).getBrightness();

                        d += .005* targetCropped.getPixel(i-1,  j).getBrightness() - .005*ditherCropped.getPixel(i-1, j).getBrightness();

                        d += .005* targetCropped.getPixel(i,  j+1).getBrightness() -.005* ditherCropped.getPixel(i, j+1).getBrightness();

                        d += .005* targetCropped.getPixel(i,  j-1).getBrightness() - .005*ditherCropped.getPixel(i, j-1).getBrightness();

                        if(d > diff){
                            diff = d;
                            x = i;
                            y = j;
                        }
                    }
                    ditherCropped.setPixel(x,  y,  WHITE);
                }

            } else {
                int x = 0;
                int y = 0;
                double diff = 0;

                for(int i = 1; i < ditherCropped.getWidth()-1; i ++){
                    for(int j = 1; j < ditherCropped.getHeight()-1; j ++){
                        double d =  ditherCropped.getPixel(i, j).getBrightness() -targetCropped.getPixel(i,  j).getBrightness();
                        d += -.005* targetCropped.getPixel(i+1,  j).getBrightness() +.005* ditherCropped.getPixel(i+1, j).getBrightness();

                        d += -.005* targetCropped.getPixel(i-1,  j).getBrightness() +.005* ditherCropped.getPixel(i+1, j).getBrightness();

                        d += -.005* targetCropped.getPixel(i,  j+1).getBrightness() + .005*ditherCropped.getPixel(i, j+1).getBrightness();

                        d += -.005* targetCropped.getPixel(i,  j-1).getBrightness() + .005*ditherCropped.getPixel(i, j-1).getBrightness();

                        if(d > diff){
                            diff = d;
                            x = i;
                            y = j;
                        }
                    }
                    ditherCropped.setPixel(x,  y,  BLACK);
                }
            }

    }
    ditheredFrame.resumeNotifications();
}

I take it that this is deterministic? If so, how fast is it?

It's random, and takes about 3 seconds on my computer.

While perhaps not the greatest-fidelity algorithm, the results are art all by themselves.

I really like the look of this algorithm! But I think maybe it looks so good partly because it produces a texture roughly similiar to fur, and this is an animal with fur. But I am not completely sure this is true. Could you post another image of e.g. a car?

I think this is the best answer, both in terms of originality of the algorithm and in terms of awesomeness of results. I'd also really like to see it run on some other images as well.

Ghostscript (with little help of ImageMagick)
Far from being my 'own new algorithm', but, sorry, could not resist it.
convert puppy.jpg puppy.pdf && \
convert puppy.jpg -depth 8 -colorspace Gray -resize 20x20! -negate gray:- | \
gs -q -sDEVICE=ps2write -o- -c \
    '<</Thresholds (%stdin) (r) file 400 string readstring pop
       /HalftoneType 3 /Width 20 /Height 20
     >>sethalftone' \
    -f puppy.pdf | \
gs -q -sDEVICE=pngmono -o puppy.png -

Of course it works better without 'same size' restraint.

This is hilarious. I am stunned by the fact that no one has commented on this Warhol-style marvel.

JAVA
Here is my submission. Takes a JPG image, calculates pixel per pixel luminosity (thanks to Bonan in this SO question) and then check it against a random pattern for knowing if the resulting pixel will be black or white. Darkerst pixels will be always black and brightest pixels will be always white to preserve image details.
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;

import javax.imageio.ImageIO;

public class DitherGrayscale {

    private BufferedImage original;
    private double[] threshold = { 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31,
            0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42,
            0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53,
            0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64,
            0.65, 0.66, 0.67, 0.68, 0.69 };

    public static void main(String[] args) {
        DitherGrayscale d = new DitherGrayscale();
        d.readOriginal();
        d.dither();

    }

    private void readOriginal() {
        File f = new File("original.jpg");
        try {
            original = ImageIO.read(f);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void dither() {
        BufferedImage imRes = new BufferedImage(original.getWidth(),
                original.getHeight(), BufferedImage.TYPE_INT_RGB);
        Random rn = new Random();
        for (int i = 0; i < original.getWidth(); i++) {
            for (int j = 0; j < original.getHeight(); j++) {

                int color = original.getRGB(i, j);

                int red = (color >>> 16) & 0xFF;
                int green = (color >>> 8) & 0xFF;
                int blue = (color >>> 0) & 0xFF;

                double lum = (red * 0.21f + green * 0.71f + blue * 0.07f) / 255;

                if (lum <= threshold[rn.nextInt(threshold.length)]) {
                    imRes.setRGB(i, j, 0x000000);
                } else {
                    imRes.setRGB(i, j, 0xFFFFFF);
                }

            }
        }
        try {
            ImageIO.write(imRes, "PNG", new File("result.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

Other examples:

Also works with full color images:

CJam
lNl_~:H;:W;Nl;1N[{[{ri}W*]{2/{:+}%}:P~}H*]z{P}%:A;H{W{I2/A=J2/=210/[0X9EF]=I2%2*J2%+m>2%N}fI}fJ

95 bytes :)
It uses the ASCII PGM (P2) format with no comment line, for both input and output.
The method is very basic: it adds up squares of 2*2 pixels, converts to the 0..4 range, then uses a corresponding pattern of 4 bits to generate 2*2 black-and-white pixels.
That also means that the width and height must be even.
Sample:

And a random algorithm in only 27 bytes:
lNl_~*:X;Nl;1N{ri256mr>N}X*

It uses the same file format.
Sample:

And finally a mixed approach: random dithering with a bias towards a checkerboard pattern; 44 bytes:
lNl_~:H;:W;Nl;1NH{W{ri128_mr\IJ+2%*+>N}fI}fJ

Sample:

The first one is comparable to the Nintendo DSi's "Flipnote Studio" application.

Python
The idea is following: The image gets divided in to n x n tiles. We calculate the average colour each of those tiles. Then we map the colour range 0 - 255 to the range 0 - n*n which gives us a new value v. Then we colour all pixels from that tile black, and randomly colour v pixels within that tile white. It is far from optimal but still gives us recognizable results. Depending on the resolution, it works usually best at n=2 or n=3. While in n=2 you can already find artefacts from the 'simulated colour depth, in case n=3 it can already get somewhat blurry. I assumed that the images should stay the same size, but you can of course also use this method and just double/triple the size of the generated image in order to get more details.
PS: I know that I am a bit late to the party, I remember that I did not have any ideas when the challenge started but now just had this brain wave=)
from PIL import Image
import random
im = Image.open("dog.jpg") #Can be many different formats.
new = im.copy()
pix = im.load()
newpix = new.load()
width,height=im.size
print([width,height])
print(pix[1,1])

window = 3 # input parameter 'n'

area = window*window
for i in range(width//window):     #loop over pixels
    for j in range(height//window):#loop over pixels
        avg = 0
        area_pix = []
        for k in range(window):
            for l in range(window):
                area_pix.append((k,l))#make a list of coordinates within the tile
                try:
                    avg += pix[window*i+k,window*j+l][0]
                    newpix[window*i+k,window*j+l] = (0,0,0) #set everything to black
                except IndexError:
                    avg += 255/2 #just an arbitrary mean value (when were outside of the image)
                                # this is just a dirty trick for coping with images that have
                                # sides that are not multiples of window
        avg = avg/area
        # val = v is the number of pixels within the tile that will be turned white
        val = round(avg/255 * (area+0.99) - 0.5)#0.99 due to rounding errors
        assert val<=area,'something went wrong with the val'
        print(val)
        random.shuffle(area_pix) #randomize pixel coordinates
        for m in range(val):
            rel_coords = area_pix.pop()#find random pixel within tile and turn it white
            newpix[window*i+rel_coords[0],window*j+rel_coords[1]] = (255,255,255)

new.save('dog_dithered'+str(window)+'.jpg')

Results:
n=2:

n=3:

Java (1.4+)
I am not sure as to whether I am re-inventing the wheel here but I think it may be unique...

With limited random sequences

Pure random dithering

City image from Averroes's answer
The algorithm uses the concept of localized luminosity energy and normalizing to retain features. The initial version then used a random jitter to produce a dithered look over areas of similar luminosity. However it was not that visually appealing. To counter this, a limited set of limited random sequences are mapped to raw input pixel luminosity and samples are used iteratively and repeatedly yielding dithered looking backgrounds.
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;

public class LocalisedEnergyDitherRepeatRandom {

    static private final float EIGHT_BIT_DIVISOR=1.0F/256;
    private static final int KERNEL_SIZE_DIV_2 =4;
    private static final double JITTER_MULTIPLIER=0.01;
    private static final double NO_VARIANCE_JITTER_MULTIPLIER=1.5;
    private static final int RANDOM_SEQUENCE_LENGTH=10;
    private static final int RANDOM_SEQUENCE_COUNT=20;
    private static final boolean USE_RANDOM_SEQUENCES=true;

    public static void main(String args[]) throws Exception
    {
        BufferedImage image = ImageIO.read(new File("data/dog.jpg"));
        final int width = image.getWidth();
        final int height = image.getHeight();
        float[][][] yuvImage =convertToYUVImage(image);
        float[][][] outputYUVImage = new float[width][height][3];
        double circularKernelLumaMean,sum,jitter,outputLuma,variance,inputLuma;
        int circularKernelPixelCount,y,x,kx,ky;
        double[][] randomSequences = new double[RANDOM_SEQUENCE_COUNT][RANDOM_SEQUENCE_LENGTH];
        int[] randomSequenceOffsets = new int[RANDOM_SEQUENCE_COUNT];

        // Generate random sequences
        for (y=0;y<RANDOM_SEQUENCE_COUNT;y++)
        {
            for (x=0;x<RANDOM_SEQUENCE_LENGTH;x++)
            {
                randomSequences[y][x]=Math.random();
            }
        }

        for (y=0;y<height;y++)
        {
            for (x=0;x<width;x++)
            {
                circularKernelLumaMean=0;
                sum=0;
                circularKernelPixelCount=0;

                /// calculate the mean of the localised surrounding pixels contained in
                /// the area of a circle surrounding the pixel.
                for (ky=y-KERNEL_SIZE_DIV_2;ky<y+KERNEL_SIZE_DIV_2;ky++)
                {
                    if (ky>=0 && ky<height)
                    {
                        for (kx=x-KERNEL_SIZE_DIV_2;kx<x+KERNEL_SIZE_DIV_2;kx++)
                        {
                            if (kx>=0 && kx<width)
                            {
                                double distance= Math.sqrt((x-kx)*(x-kx)+(y-ky)*(y-ky));

                                if (distance<=KERNEL_SIZE_DIV_2)
                                {
                                    sum+=yuvImage[kx][ky][0];
                                    circularKernelPixelCount++;
                                }
                            }
                        }
                    }
                }

                circularKernelLumaMean=sum/circularKernelPixelCount;

                /// calculate the variance of the localised surrounding pixels contained in
                /// the area of a circle surrounding the pixel.
                sum =0;

                for (ky=y-KERNEL_SIZE_DIV_2;ky<y+KERNEL_SIZE_DIV_2;ky++)
                {
                    if (ky>=0 && ky<height)
                    {
                        for (kx=x-KERNEL_SIZE_DIV_2;kx<x+KERNEL_SIZE_DIV_2;kx++)
                        {
                            if (kx>=0 && kx<width)
                            {
                                double distance= Math.sqrt((x-kx)*(x-kx)+(y-ky)*(y-ky));

                                if (distance<=KERNEL_SIZE_DIV_2)
                                {
                                    sum+=Math.abs(yuvImage[kx][ky][0]-circularKernelLumaMean);
                                }
                            }
                        }
                    }
                }

                variance = sum/(circularKernelPixelCount-1);

                if (variance==0)
                {
                    // apply some jitter to ensure there are no large blocks of single colour
                    inputLuma=yuvImage[x][y][0];
                    jitter = Math.random()*NO_VARIANCE_JITTER_MULTIPLIER;
                }
                else
                {
                    // normalise the pixel based on localised circular kernel
                    inputLuma = outputYUVImage[x][y][0]=(float) Math.min(1.0, Math.max(0,yuvImage[x][y][0]/(circularKernelLumaMean*2)));
                    jitter = Math.exp(variance)*JITTER_MULTIPLIER;
                }

                if (USE_RANDOM_SEQUENCES)
                {
                    int sequenceIndex =(int) (yuvImage[x][y][0]*RANDOM_SEQUENCE_COUNT);
                    int sequenceOffset = (randomSequenceOffsets[sequenceIndex]++)%RANDOM_SEQUENCE_LENGTH;
                    outputLuma=inputLuma+randomSequences[sequenceIndex][sequenceOffset]*jitter*2-jitter;
                }
                else
                {
                    outputLuma=inputLuma+Math.random()*jitter*2-jitter;
                }

                // convert 8bit luma to 2 bit luma
                outputYUVImage[x][y][0]=outputLuma<0.5?0:1.0f;
            }
        }

        renderYUV(image,outputYUVImage);
        ImageIO.write(image, "png", new File("data/dog.jpg.out.png"));
    }

      /**
       * Converts the given buffered image into a 3-dimensional array of YUV pixels
       * @param image the buffered image to convert
       * @return 3-dimensional array of YUV pixels
       */
      static private float[][][] convertToYUVImage(BufferedImage image)
      {
        final int width = image.getWidth();
        final int height = image.getHeight();
        float[][][] yuv = new float[width][height][3];
        for (int y=0;y<height;y++)
        {
          for (int x=0;x<width;x++)
          {
            int rgb = image.getRGB( x, y );
            yuv[x][y]=rgb2yuv(rgb);
          }
        }
        return yuv;
      }

      /**
       * Renders the given YUV image into the given buffered image.
       * @param image the buffered image to render to
       * @param pixels the YUV image to render.
       * @param dimension the
       */
      static private void renderYUV(BufferedImage image, float[][][] pixels)
      {
        final int height = image.getHeight();
        final int width = image.getWidth();
        int rgb;

        for (int y=0;y<height;y++)
        {
          for (int x=0;x<width;x++)
          {

            rgb = yuv2rgb( pixels[x][y] );
            image.setRGB( x, y,rgb );
          }
        }
      }

      /**
       * Converts a RGB pixel into a YUV pixel
       * @param rgb a pixel encoded as 24 bit RGB
       * @return array representing a pixel. Consisting of Y,U and V components
       */
      static float[] rgb2yuv(int rgb)
      {
        float red = EIGHT_BIT_DIVISOR*((rgb>>16)&0xFF);
        float green = EIGHT_BIT_DIVISOR*((rgb>>8)&0xFF);
        float blue = EIGHT_BIT_DIVISOR*(rgb&0xFF);

        float Y = 0.299F*red + 0.587F * green + 0.114F * blue;
        float U = (blue-Y)*0.565F;
        float V = (red-Y)*0.713F;

        return new float[]{Y,U,V};
      }

      /**
       * Converts a YUV pixel into a RGB pixel
       * @param yuv array representing a pixel. Consisting of Y,U and V components
       * @return a pixel encoded as 24 bit RGB
       */
      static int yuv2rgb(float[] yuv)
      {
        int red = (int) ((yuv[0]+1.403*yuv[2])*256);
        int green = (int) ((yuv[0]-0.344 *yuv[1]- 0.714*yuv[2])*256);
        int blue = (int) ((yuv[0]+1.77*yuv[1])*256);

        // clamp to 0-255 range
        red=red<0?0:red>255?255:red;
        green=green<0?0:green>255?255:green;
        blue=blue<0?0:blue>255?255:blue;

        return (red<<16) | (green<<8) | blue;
      }

}

Very nice. It definitely gives a different effect than the other answers so far.

@Geobits Yeah, it surprised me how effective it is. However I am not sure whether i would call it a dithering as it produces quite visually different output

That does look quite unique.

Dyalog APL
This is an implementation of ordered dither with a special dither array.
The input format is a restricted form of raster PGM while it is also the default style produced by Netpbm programs that requires no comment line, file header separated by newline character rather than arbitrary whitespace, and assumes "maxval" to be 255, so the file can be handled easily with APL's ⎕MAP system function.
The output format satisfies raster PBM specification.
This program can dither images as large as 3000×2000 in very short time, however for larger image it needs more than default workspace size.
∇img←readpgm file;data;size
 data←83 ¯1 ⎕MAP file
⍝ drop magic
 data←(⊢↓⍨⍳∘10)data
 size←⌽⍎⎕UCS ¯1↓(⊢↑⍨⍳∘10)data
 img←size⍴256|(⊢↓⍨⍳∘10)⍣2⊢data
∇

∇img writepbm file;data;size;h;s;tie
 tie←file(⎕NCREATE⍠'IfExists' 'Error')0
 h←10,⍨⎕UCS'P4 ',⍕size←⌽⍴img
 tie ⎕ARBOUT h
 s←8×⌈8÷⍨⊃size
 data←,⍉s↑⍉img
 data←2⊥⍉data⍴⍨8,⍨8÷⍨≢data
 tie ⎕ARBOUT data
 ⎕NUNTIE tie
∇

da←1 8⍴51 25 61 10 45 57 8 16
da⍪←58 6 34 23 1 36 49 30
da⍪←44 32 29 14 41 62 20 12
da⍪←2 21 60 52 47 4 24 55
da⍪←50 9 18 7 38 28 15 40
da⍪←37 56 26 43 59 11 53 35
da⍪←46 13 31 3 48 22 5 63
da⍪←0 19 33 54 17 39 27 42

dither←{
    ⎕IO←0
    x y←⍴⍵
    a b←⍴⍺
    (63×⍵÷255)<(,⍺)[(x y⍴y⍴⍳b)+⍉y x⍴x⍴b×⍳a]
}

'out.pbm' writepbm⍨ da dither readpgm 'input.pgm'

Any file format you want is fine.

Let's define a very compact, theoretical file format for this question as any of the existing file formats have too much overhead to write a quick answer for.
Let the first four bytes of the image file define the width and height of the image in pixels, respectively:
00000001 00101100 00000001 00101100
width: 300 px     height: 300 px

followed by w * h bytes of grayscale values from 0 to 255:
10000101 10100101 10111110 11000110 ... [89,996 more bytes]

Then, we can define a piece of code in Python (145 bytes) that will take this image and do:
import random
f=open("a","rb");g=open("b","wb");g.write(f.read(4))
for i in f.read():g.write('\xff' if ord(i)>random.randint(0,255) else '\x00')

which "dithers" by returning white or black with probability equal to the grayscale value of that pixel.

Applied on the sample image, it gives something like this:

It's not too pretty, but it does look very similar when scaled down in a preview, and for just 145 bytes of Python, I don't think you can get much better.

Can you share an example? I believe this is random dithering, and the results are not the cleanest...nice profile picture though

This is indeed random dithering, and I'm making an example of your sample picture at the moment.

I think it might benefit from a contrast boost.  I don't know python, but I assume random.randint(0,255) is picking a random number between 0 and 255. Try limiting to between say 55 and 200, which will force any shades outside that range to be pure black or white. With many pictures you can get a good, striking image with no dithering, just a simple threshold. (Random + contrast boost would give an image intermediate between your current image and simple threshold.)

I think random dithering should be called Geiger dithering (because it looks like a Geiger counter's output). Who agrees?

That's almost precisely what ImageMagick and GraphicsMagick do with the "-random-threshold" option that I added along with "-ordered-dither" years ago (added to my answer).  Again, bumping the gamma helps with getting the right intensity.  I agree with the "Geiger dithering" suggestion.

Cobra
Takes a 24-bit or 32-bit PNG/BMP file (JPG produces output with some greys in it). It is also extensible to files containing color.
It uses speed-optimized ELA to dither the image into 3-bit color, which will return as black/white when given your test image.
Did I mention that it's really fast?
use System.Drawing
use System.Drawing.Imaging
use System.Runtime.InteropServices
use System.IO

class BW_Dither

    var path as String = Directory.getCurrentDirectory to !
    var rng = Random()

    def main
        file as String = Console.readLine to !
        image as Bitmap = Bitmap(.path+"\\"+file)
        image = .dither(image)
        image.save(.path+"\\test\\image.png")

    def dither(image as Bitmap) as Bitmap

        output as Bitmap = Bitmap(image)

        layers as Bitmap[] = @[ Bitmap(image), Bitmap(image), Bitmap(image),
                                Bitmap(image), Bitmap(image), Bitmap(image),
                                Bitmap(image)]

        layers[0].rotateFlip(RotateFlipType.RotateNoneFlipX)
        layers[1].rotateFlip(RotateFlipType.RotateNoneFlipY)
        layers[2].rotateFlip(RotateFlipType.Rotate90FlipX)
        layers[3].rotateFlip(RotateFlipType.Rotate90FlipY)
        layers[4].rotateFlip(RotateFlipType.Rotate90FlipNone)
        layers[5].rotateFlip(RotateFlipType.Rotate180FlipNone)
        layers[6].rotateFlip(RotateFlipType.Rotate270FlipNone)

        for i in layers.length, layers[i] = .dither_ela(layers[i])

        layers[0].rotateFlip(RotateFlipType.RotateNoneFlipX)
        layers[1].rotateFlip(RotateFlipType.RotateNoneFlipY)
        layers[2].rotateFlip(RotateFlipType.Rotate270FlipY)
        layers[3].rotateFlip(RotateFlipType.Rotate270FlipX)
        layers[4].rotateFlip(RotateFlipType.Rotate270FlipNone)
        layers[5].rotateFlip(RotateFlipType.Rotate180FlipNone)
        layers[6].rotateFlip(RotateFlipType.Rotate90FlipNone)

        vals = List<of List<of uint8[]>>()
        data as List<of uint8[]> = .getData(output)
        for l in layers, vals.add(.getData(l))
        for i in data.count, for c in 3
            x as int = 0
            for n in vals.count, if vals[n][i][c] == 255, x += 1
            if x > 3.5, data[i][c] = 255 to uint8
            if x < 3.5, data[i][c] = 0 to uint8

        .setData(output, data)
        return output

    def dither_ela(image as Bitmap) as Bitmap

        error as decimal[] = @[0d, 0d, 0d]
        rectangle as Rectangle = Rectangle(0, 0, image.width, image.height)
        image_data as BitmapData = image.lockBits(rectangle, ImageLockMode.ReadWrite, image.pixelFormat) to !
        pointer as IntPtr = image_data.scan0
        bytes as uint8[] = uint8[](image_data.stride * image.height)
        pfs as int = Image.getPixelFormatSize(image.pixelFormat) // 8
        Marshal.copy(pointer, bytes, 0, image_data.stride * image.height)

        for y as int in image.height, for x as int in image.width
            position as int = (y * image_data.stride) + (x * pfs)
            for i in 3
                error[i] -= bytes[position + i]
                if Math.abs(error[i] + 255 - bytes[position + i]) < Math.abs(error[i] - bytes[position + i])
                    bytes[position + i] = 255 to uint8
                    error[i] += 255
                else, bytes[position + i] = 0 to uint8

        Marshal.copy(bytes, 0, pointer, image_data.stride * image.height)
        image.unlockBits(image_data)
        return image

    def getData(image as Bitmap) as List<of uint8[]>

        rectangle as Rectangle = Rectangle(0, 0, image.width, image.height)
        image_data as BitmapData = image.lockBits(rectangle, ImageLockMode.ReadOnly, image.pixelFormat) to !
        pointer as IntPtr = image_data.scan0
        bytes as uint8[] = uint8[](image_data.stride * image.height)
        pixels as List<of uint8[]> = List<of uint8[]>()
        for i in image.width * image.height, pixels.add(nil)
        pfs as int = Image.getPixelFormatSize(image.pixelFormat) // 8
        Marshal.copy(pointer, bytes, 0, image_data.stride * image.height)

        count as int = 0
        for y as int in image.height, for x as int in image.width
            position as int = (y * image_data.stride) + (x * pfs)
            if pfs == 4, alpha as uint8 = bytes[position + 3]
            else, alpha as uint8 = 255
            pixels[count] = @[
                                bytes[position + 2], #red
                                bytes[position + 1], #green
                                bytes[position],     #blue
                                alpha]               #alpha
            count += 1

        image.unlockBits(image_data)
        return pixels

    def setData(image as Bitmap, pixels as List<of uint8[]>)
        if pixels.count <> image.width * image.height, throw Exception()
        rectangle as Rectangle = Rectangle(0, 0, image.width, image.height)
        image_data as BitmapData = image.lockBits(rectangle, ImageLockMode.ReadWrite, image.pixelFormat) to !
        pointer as IntPtr = image_data.scan0
        bytes as uint8[] = uint8[](image_data.stride * image.height)
        pfs as int = Image.getPixelFormatSize(image.pixelFormat) // 8
        Marshal.copy(pointer, bytes, 0, image_data.stride * image.height)

        count as int = 0
        for y as int in image.height, for x as int in image.width
            position as int = (y * image_data.stride) + (x * pfs)
            if pfs == 4, bytes[position + 3] = pixels[count][3] #alpha
            bytes[position + 2] = pixels[count][0]              #red
            bytes[position + 1] = pixels[count][1]              #green
            bytes[position] = pixels[count][2]                  #blue
            count += 1

        Marshal.copy(bytes, 0, pointer, image_data.stride * image.height)
        image.unlockBits(image_data)

To reduce repetition, have you considered creating a temporary variable col, and leaving the image.setPixel(x,y,col) until the very end?

What's with the trees image?

It looks nice, and provides an example of this working with colors as well.

Java
Low level code, using PNGJ and a noise addition plus basic diffusion. This implementation requires a grayscale 8-bits PNG source.
import java.io.File;
import java.util.Random;

import ar.com.hjg.pngj.ImageInfo;
import ar.com.hjg.pngj.ImageLineInt;
import ar.com.hjg.pngj.PngReaderInt;
import ar.com.hjg.pngj.PngWriter;

public class Dither {

    private static void dither1(File file1, File file2) {
        PngReaderInt reader = new PngReaderInt(file1);
        ImageInfo info = reader.imgInfo;
        if( info.bitDepth != 8 && !info.greyscale ) throw new RuntimeException("only 8bits grayscale valid");
        PngWriter writer = new PngWriter(file2, reader.imgInfo);
        ImageLineInt line2 = new ImageLineInt(info);
        int[] y = line2.getScanline();
        int[] ye = new int[info.cols];
        int ex = 0;
        Random rand = new Random();
        while(reader.hasMoreRows()) {
            int[] x = reader.readRowInt().getScanline();
            for( int i = 0; i < info.cols; i++ ) {
                int t = x[i] + ex + ye[i];
                y[i] = t > rand.nextInt(256) ? 255 : 0;
                ex = (t - y[i]) / 2;
                ye[i] = ex / 2;
            }
            writer.writeRow(line2);
        }
        reader.end();
        writer.end();
    }

    public static void main(String[] args) {
        dither1(new File(args[0]), new File(args[1]));
        System.out.println("See output in " + args[1]);
    }

}

(Add this jar to your build path if you want to try it).

As a bonus: this is extremely efficient in memory usage (it only stores three rows) so it could be used for huge images.

Nitpick: I would think "used for huge images" is not so important (have you ever seen a >8 GB grayscale PNG?), but "used on e.g. embedded devices" is a much more salient point.

I like it but it looks a bit blurred around the edges, methinks.

Python
The code is quite bad, so I'll try to explain the algorithm. For each pixel, it stores the brightness of the pixel in the variable brightness, and changes brightness based on the values of x % 2 and y % 2, where x and y are coordinates of that pixel. This creates a typical two by two regular dithering pattern. Then, brightness is randomly changed by some amount to hide banding and strongly visible patterns created by the dithering algorithm.
Finally, brightness is changed by the difference between the average brightness of the current pixel and the average brightness of the pixel around it. This makes details and outlines more visible, since small groups of pixels that are very different from their surroundings are more likely to get a different color than their surroundings. The brightness is then rounded to 0 (black) or 1 (white).
The program has four parameters that can be changed to change the result: dither_details, which determines how likely pixels with a different brightness than their surroundings are to get a different color than their surroundings; dither_regular, which determines how strong the typical two by two dithering pattern is, dither_random, which determines the strength of the random dithering; and s, which determines how big an area of its surrounding the pixels are compared to.

When dither_details equals 999 and s equals 2, the program gives a result quite similar to @Moogie's submission (the rectangle-like patterns are likely a product of image compression):

import matplotlib.image as mplimg
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy

image = mplimg.imread("pup.png")

new_im = [
    [0 for x in range(len(image[0]))]
for y in range(len(image))]

def avg(x, y, f):
    sum_ = 0
    n = 0

    for x1 in range(x, x + f):
        for y1 in range(y, y + f):

            if x1 < 0 or x1 >= len(image[0]) or y1 < 0 or y1 >= len(image):
                continue

            n += 1
            sum_ += image[y1][x1]

    return sum_ / n

dither_details = 3.0
dither_regular = 0.15
dither_random = 0.03
s = 3

for x in range(len(image[0])):
    for y in range(len(image)):

        brightness = image[y][x]

        if x % 2 == 0 and y % 2 == 0:
            brightness += dither_regular
        elif x % 2 == 1 and y % 2 == 1:
            brightness += dither_regular / 2
        elif x % 2 == 0 and y % 2 == 1:
            brightness -= dither_regular
        elif x % 2 == 1 and y % 2 == 0:
            brightness -= dither_regular / 2

        brightness += numpy.random.normal(scale = dither_random)

        average_brightness = avg(x - s, y - s, s * 2 + 1)
        brightness += image[y][x] * dither_details - average_brightness * dither_details

        new_im[y][x] = 0 if brightness < 0.5 else 1

dpi = 16
mpl.rcParams['savefig.dpi'] = dpi * 16
plt.figure(figsize=(len(image[0]) / dpi, len(image) / dpi), dpi = dpi * 16)
plt.axis("off")
plt.imshow(new_im, cmap = "gray", interpolation = "nearest")
plt.savefig("dither.png", bbox_inches="tight")
plt.show()

I like this output.

Thanks, @Simd :))

Java
Just a simple RNG-based algorithm, plus some logic for dealing with color images. Has probability b of setting any given pixel to white, sets it to black otherwise; where b is that pixel's original brightness.
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import java.util.Scanner;

import javax.imageio.ImageIO;

public class Ditherizer {
    public static void main(String[]a) throws IOException{
        Scanner input=new Scanner(System.in);
        Random rand=new Random();
        BufferedImage img=ImageIO.read(new File(input.nextLine()));
        for(int x=0;x<img.getWidth();x++){
            for(int y=0;y<img.getHeight();y++){
                Color c=new Color(img.getRGB(x, y));
                int r=c.getRed(),g=c.getGreen(),b=c.getBlue();
                double bright=(r==g&&g==b)?r:Math.sqrt(0.299*r*r+0.587*g*g+0.114*b*b);
                img.setRGB(x,y,(rand.nextInt(256)>bright?Color.BLACK:Color.WHITE).getRGB());
            }
        }
        ImageIO.write(img,"jpg",new File(input.nextLine()));
        input.close();
    }
}

Here's a potential result for the dog image:

Why don't you add the explanation to the top instead of the bottom where nobody is going to read it? I really like that idea=)

JavaScript (Node.js), 28 bytes
x=>x.map(t=>t>Math.random())

Try it online!

Trying to golf one

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

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