text:
Standardise a Phinary Number
Background
Most people on here should be familiar with a few integer base systems: decimal, binary, hexadecimal, octal. E.g. in the hexadecimal system, a number \$abc.de_{16}\$ would represent
$$a\times16^2 + b\times16^1 + c\times16^0 + d\times16^{-1} + e\times16^{-2}$$
However, one can also use non-integer bases, like irrational numbers. Once such base uses the golden ratio \$φ = \frac{1+√5}2 ≈ 1.618...\$. These are defined analogously to integer bases. So a number \$abc.de_φ\$ (where \$a\$ to \$e\$ are integer digits) would represent
$$a\timesφ^2 + b\timesφ^1 + c\timesφ^0 + d\timesφ^{-1} + e\timesφ^{-2}$$
Note that in principle any of the digits could be negative (although we're not used to that) - we'll represent a negative digit with a leading \$\text{~}\$. For the purpose of this question we restrict ourselves to digits from \$\text{~}9\$ to \$9\$, so we can unambiguously write a number as one string (with tildes in between). So
$$-2\timesφ^2 + 9\timesφ^1 + 0\timesφ^0 + -4\timesφ^{-1} + 3\timesφ^{-2}$$
would be written as \$\text{~}290.\text{~}43\$. We call such a number a phinary number.
A phinary number can always be represented in standard form, which means that the representation uses only digits \$1\$ and \$0\$, without containing \$11\$ anywhere, and with an optional minus sign to indicate that the entire number is negative. (Interestingly, every integer has a unique finite representation in standard form.)
Representations which are not in standard form can always be converted into standard form using the following observations:

\$011_φ = 100_φ\$ (because \$φ^2 = φ + 1\$)
\$0200_φ = 1001_φ\$ (because \$φ^2 + \frac1φ = 2φ\$)
\$0\text{~}10_φ = \text{~}101_φ\$ (because \$φ - \frac1φ = 1\$)

In addition:

If the most significant digit is \$\text{~}1\$ (with the rest of the number being standard form), the number is negative, and we can convert it into standard form by swapping all \$1\$ and \$\text{~}1\$, prepending a minus sign, and applying the above three rules again until we obtain the standard form.

Here is an example of such a normalisation of \$1\text{~}3.2\text{~}1_φ\$ (I'm using additional spaces for positive digits, to keep each digit position aligned):

      1~3. 2~1φ         Rule:
=     0~2. 3~1φ         (3)
=    ~1~1. 4~1φ         (3)
=  ~1 0 0. 4~1φ         (3)
=  ~1 0 0. 3 0 1φ       (3)
=  ~1 0 1. 1 0 2φ       (2)
=  ~1 1 0. 0 0 2φ       (1)
=  ~1 1 0. 0 1 0 0 1φ   (2)
= - 1~1 0. 0~1 0 0~1φ   (4)
= - 0 0 1. 0~1 0 0~1φ   (3)
= - 0 0 1.~1 0 1 0~1φ   (3)
= - 0 0 0. 0 1 1 0~1φ   (3)
= - 0 0 0. 0 1 1~1 0 1φ (3)
= - 0 0 0. 0 1 0 0 1 1φ (3)
= - 0 0 0. 0 1 0 1 0 0φ (1)

Yielding \$-0.0101_φ\$.
For further reading, Wikipedia has a very informative article on the topic.
The Challenge
Hence, or otherwise, write a program or function which, given a string representing a phinary number (as described above), outputs its standard form, without leading or trailing zeroes. The input does not necessarily contain the phinary point, but will always contain the digit left of it (so no \$.123\$). The output must always include the phinary point and at least one digit to the left of it.
You may take input via STDIN, ARGV or function argument and either return the result or print it to STDOUT.
You may use a different algorithm than the above procedure as long as it is in principle correct and exact for arbitrary (valid) inputs - that is, the only limits which could potentially break your implementation should be technical limitations like the size of built-in data types or the available RAM. For instance, evaluating the input as a floating-point number and then picking digits greedily is not allowed, as one could find inputs for which floating-point inaccuracies would lead to incorrect results.
This is code golf, the shortest answer (in bytes) wins.
Test Cases
Input       Output

1           1.
9           10010.0101
1.618       10000.0000101
1~3.2~1     -0.0101
0.~1021     0. (or -0.)
105.~2      1010.0101
~31~5.~1    -100000.1001

Now I want to use negative digits in my numbers ! 1~3 * 6 == 5~8

Javascript (ES6) - 446 418 422 420 bytes
Minified:
F=s=>{D=[];z='000000000';N=t=n=i=e=0;s=(z+s.replace(/^([^.]*)$/,'$1.')+z).replace(/~/g,'-').replace(/-?\d/g,s=>((D[n++]=s/1),0));for(;i<n-3;i=j){if(p=D[j=i+1]){if(!e&&p<0){D=D.map(k=>-k);N=~N;p=-p}e=1}d=D[i];x=D[i+2];m=D[i+3];if(p<0){d--;p++;x++;e=j=0}if(p>1){d++;m++;p-=2;e=j=0}if(!d&&p*x==1){d=p;e=j=p=x=0}D[i]=d;D[i+1]=p;D[i+2]=x;D[i+3]=m}return(N?'-':'')+s.replace(/0/g,()=>D[t++]).replace(/^(0(?!\.))+|0+$/g,'')}

Expanded:
F = s => {
    D = [];
    z = '000000000';
    N = t = n = i = e = 0;
    s = (z + s.replace( /^([^.]*)$/, '$1.' ) + z).replace( /~/g, '-' ).
        replace( /-?\d/g, s => ((D[n++]=s/1),0) );

    for( ; i < n-3; i = j ) {
        if( p = D[j = i+1] ) {
            if( !e && p < 0 ) {
                D = D.map( k=>-k );
                N = ~N;
                p = -p;
            }
            e = 1;
        }
        d = D[i];
        x = D[i+2];
        m = D[i+3];

        if( p < 0 ) {
            d--;
            p++;
            x++;
            e = j = 0;
        }
        if( p > 1 ) {
            d++;
            m++;
            p-=2;
            e = j = 0;
        }
        if( !d && p*x == 1 ) {
            d = p;
            e = j = p = x = 0;
        }

        D[i] = d;
        D[i+1] = p;
        D[i+2] = x;
        D[i+3] = m;
    }

    return (N ? '-' : '') + s.replace( /0/g, ()=>D[t++] ).replace( /^(0(?!\.))+|0+$/g, '' );
}

The code produces a function F that performs the specified conversion.
It's a tough problem to golf. Numerous edge cases creep up that prevent simplification of the code. In particular, dealing with negatives is a pain, both in terms of parsing and in terms of logical handling.
I should note that the code only handles a "reasonable range" of inputs. To extend the domain of the function without bound, the number of zeros in z can be increased, and the constant bounding the while( c++ < 99 ) loop can be increased. The range currently supported is already overkill for the supplied test cases.
Sample Outputs
F('1')          1.
F('9')          10010.0101
F('1~3.2~1')    -0.0101
F('0.~1021')    -0.
F('105.~2')     1010.0101
F('~31~5.~1')   -100000.1001

The -0. isn't pretty, but the answer is still correct. I can fix it if necessary.

@MartinBüttner: You could, but it would be difficult. It bounds the number of "passes" over the full input, and each pass comprises several operations. My gut feel is that the number of passes required to normalize any n-digit input would be somewhere between n and n log(n). In any case, the number of passes can be raised by a factor of 10 for every character added. The number of zeroes in the z constant is also an interesting problem. I suspect that 9 is overkill for any possible input.

@MartinBüttner: Thanks. I removed the escape in the character class. As for the $0, Javascript doesn't support it. Or at least Firefox doesn't. :P

Okay, I think you never need more than 7 leading zeroes as buffer, but I think trailing zeroes will be a bit harder to estimate. As for the outer loop, I don't think you even need that, if you just make that a while loop (or integrate it into the inner for loop) and just break out when no more changes are found. I guess my spec could have been a bit clearer in that respect but by "in principle correct and exact for arbitrary (valid) inputs" I meant that the only theoretical limit should be the size of your built-in data types/your RAM.

@MartinBüttner: I actually put in the outer loop to save on characters. But if there shouldn't be any arbitrary limitations, I can deal with that. I've modified the code to run until no changes occur. It adds 4 bytes, but so be it.

Thanks! I'll let you know if I can figure out an upperbound on the trailing zeroes (or just a case where 9 is not enough).

@COTO To save 1 byte, you can try moving the first part of the for( i = e = 0; i < n-3; i = j ) by for(; i < n-3; i = j ) and move the declarations to the top, being N = t = n = 0; replaced with N = t = n = i = e = 0;

@IsmaelMiguel: A byte is a byte. I'll make the change. ;)

@COTO I found a place where you can save a bit more (around 4 bytes). You have j = i+1; and right below you have if( p = D[i+1] ) {. Why don't you make if( p = D[j = i+1] ) {? And since You aren't using the j var, why don't you get rid of it entirely? That will save a lot! To be honest, I don't understand how this code works, when you don't increment i (or I'm a bit blind, that's more likely).

@IsmaelMiguel: Inlining the j = i+1 saves one byte. I've made the change. Thanks for the suggestion. Think of j as the value of i on the next step. i itself is used as a variable in numerous places (up until the very end of the block) and hence can't be modified. j will contain i+1 in all cases except when any of the three operations occurs and it's reset to zero. This behaviour resets the loop counter to zero any time an operation occurs. In real code you would never do this since messing with an iterator variable is extremely bad coding practice. But in code golf, all is fair. ;)

@COTO You still can remove this i = j from the loop. It's doing nothing in there. And almost at the end, you have D[i+1] = p;. Since j = i + 1, you can replace it by D[j]=p;.

@IsmaelMiguel: j isn't held constant at a value of i+1. Notice in the three if blocks, j is reset to 0. Hence at any point after the first if block it can't be used as a proxy for i+1. The variable i itself can't be updated until the end of the loop (using the third statement in for) since its value is used right up until the end of the loop. But having said that, maybe I'm missing something. If you're able to shorten the code, test it, and verify that it still works, please post a copy to pastebin.com and a link here. I'll extend due credit to you in the answer. :)

@COTO Sorry dude, I'm not familiar with the ways of ES6, and I don't have firefox on my computer. Downloading it again is undesirable. It's 2D rendering techniques affect negatively the performance of my graphic card, making it run at 400mhz when it should be running at 900mhz on a game with DX11 graphics.

Haskell, 336 bytes
z=[0,0]
g[a,b]|a*b<0=g[b,a+b]
g x=x<z
k![a,b,c,d]=[b,a+b,d-c+read k,c]
p('.':s)=1:0:2`drop`p s
p('~':k:s)=['-',k]!p s
p(k:s)=[k]!p s
p[]=1:0:z
[1,0]&y='.':z?y
[a,b]&y=[b,a+b]?y
x@[a,b]?y@[c,d]|x==z,y==z=""|g y='-':x?[-c,-d]|g[c-1,d]='0':x&[d,c+d]|g[c,d-1]='1':x&[d,c+d-1]|0<1=[b-a,a]?[d-c,c]
m[a,b,c,d]=[1,0]?[a*d+b*c-a*c,a*c+b*d]
f=m.p

This is the greedy algorithm, but with an exact representation [a,b] of numbers a + bφ (a, b ∈ ℤ) to avoid floating-point errors. g[a,b] tests whether a + bφ < 0. Usage example:
*Main> f "9"
"10010.0101"
*Main> f "1~3.2~1"
"-0.0101"
*Main> f "0.~1021"
"0."


text:
Print all domino tilings of 4x6 rectangle
This is an extension of Fibonacci Domino Tiling. Your goal is to print all 281 ways to tile a 4x6 rectangle with 1x2 and 2x1 dominoes. Fewest bytes wins.
Use the vertical bar | to indicate a space covered by the vertical domino, and an em-dash — (count it as if it were ASCII) or hyphen - for horizontal ones.
Example output: (281 tilings, 1405 lines)
——————
——————
——————
——————

||————
||————
——————
——————

|——|——
|——|——
——————
——————

——||——
——||——
——————
——————

|————|
|————|
——————
——————

——|——|
——|——|
——————
——————

————||
————||
——————
——————

||||——
||||——
——————
——————

|||——|
|||——|
——————
——————

——————
||————
||————
——————

||——||
||——||
——————
——————

|——|||
|——|||
——————
——————

——||||
——||||
——————
——————

——————
|——|——
|——|——
——————

——————
——||——
——||——
——————

||————
||||——
——||——
——————

——||——
||||——
||————
——————

——|——|
|||——|
||————
——————

————||
||——||
||————
——————

||||||
||||||
——————
——————

——————
|————|
|————|
——————

——————
——|——|
——|——|
——————

||————
|||——|
——|——|
——————

————||
|——|||
|——|——
——————

——————
————||
————||
——————

||————
||——||
————||
——————

|——|——
|——|||
————||
——————

——||——
——||||
————||
——————

————||
——||||
——||——
——————

||||——
||||||
————||
——————

——————
||||——
||||——
——————

||——||
||||||
——||——
——————

——||||
||||||
||————
——————

——————
|||——|
|||——|
——————

——————
——————
||————
||————

||————
||————
||————
||————

|——|——
|——|——
||————
||————

——||——
——||——
||————
||————

|————|
|————|
||————
||————

——|——|
——|——|
||————
||————

————||
————||
||————
||————

||||——
||||——
||————
||————

|||——|
|||——|
||————
||————

——————
||——||
||——||
——————

||——||
||——||
||————
||————

|——|||
|——|||
||————
||————

——||||
——||||
||————
||————

——————
|——|||
|——|||
——————

——————
——||||
——||||
——————

||————
||||||
——||||
——————

——||——
||||||
||——||
——————

————||
||||||
||||——
——————

||||||
||||||
||————
||————

——————
——————
|——|——
|——|——

||————
||————
|——|——
|——|——

|——|——
|——|——
|——|——
|——|——

——||——
——||——
|——|——
|——|——

|————|
|————|
|——|——
|——|——

——|——|
——|——|
|——|——
|——|——

————||
————||
|——|——
|——|——

||||——
||||——
|——|——
|——|——

|||——|
|||——|
|——|——
|——|——

||——||
||——||
|——|——
|——|——

|——|||
|——|||
|——|——
|——|——

——||||
——||||
|——|——
|——|——

||||||
||||||
|——|——
|——|——

——————
——————
——||——
——||——

||————
||————
——||——
——||——

|——|——
|——|——
——||——
——||——

——||——
——||——
——||——
——||——

|————|
|————|
——||——
——||——

——|——|
——|——|
——||——
——||——

————||
————||
——||——
——||——

||||——
||||——
——||——
——||——

|||——|
|||——|
——||——
——||——

——————
||————
||||——
——||——

||——||
||——||
——||——
——||——

|——|||
|——|||
——||——
——||——

——||||
——||||
——||——
——||——

——————
——||——
||||——
||————

||————
||||——
||||——
||————

|——|——
||||——
||||——
|——|——

——||——
||||——
||||——
——||——

|————|
|||——|
||||——
|——|——

——|——|
|||——|
||||——
——||——

————||
||——||
||||——
——||——

||||||
||||||
——||——
——||——

——————
——|——|
|||——|
||————

||————
|||——|
|||——|
||————

——————
————||
||——||
||————

||————
||——||
||——||
||————

|——|——
|——|||
||——||
||————

——||——
——||||
||——||
||————

————||
——||||
||||——
||————

||||——
||||||
||——||
||————

——————
||||||
||||||
——————

||——||
||||||
||||——
||————

|——|||
||||||
||||——
|——|——

——||||
||||||
||||——
——||——

——————
——————
|————|
|————|

||————
||————
|————|
|————|

|——|——
|——|——
|————|
|————|

——||——
——||——
|————|
|————|

|————|
|————|
|————|
|————|

——|——|
——|——|
|————|
|————|

————||
————||
|————|
|————|

||||——
||||——
|————|
|————|

|||——|
|||——|
|————|
|————|

||——||
||——||
|————|
|————|

|——|||
|——|||
|————|
|————|

——||||
——||||
|————|
|————|

||||||
||||||
|————|
|————|

——————
——————
——|——|
——|——|

||————
||————
——|——|
——|——|

|——|——
|——|——
——|——|
——|——|

——||——
——||——
——|——|
——|——|

|————|
|————|
——|——|
——|——|

——|——|
——|——|
——|——|
——|——|

————||
————||
——|——|
——|——|

||||——
||||——
——|——|
——|——|

|||——|
|||——|
——|——|
——|——|

——————
||————
|||——|
——|——|

||——||
||——||
——|——|
——|——|

|——|||
|——|||
——|——|
——|——|

——||||
——||||
——|——|
——|——|

|——|——
||||——
|||——|
|————|

——||——
||||——
|||——|
——|——|

|————|
|||——|
|||——|
|————|

——|——|
|||——|
|||——|
——|——|

————||
||——||
|||——|
——|——|

||||||
||||||
——|——|
——|——|

|————|
||——||
||——||
|————|

——————
————||
|——|||
|——|——

||————
||——||
|——|||
|——|——

|——|——
|——|||
|——|||
|——|——

——||——
——||||
|——|||
|——|——

|————|
|——|||
|——|||
|————|

——|——|
——||||
|——|||
|————|

||||——
||||||
|——|||
|——|——

|||——|
||||||
|——|||
|————|

|——|||
||||||
|||——|
|————|

——||||
||||||
|||——|
——|——|

——————
——————
————||
————||

||————
||————
————||
————||

|——|——
|——|——
————||
————||

——||——
——||——
————||
————||

|————|
|————|
————||
————||

——|——|
——|——|
————||
————||

————||
————||
————||
————||

||||——
||||——
————||
————||

|||——|
|||——|
————||
————||

——————
||————
||——||
————||

||——||
||——||
————||
————||

|——|||
|——|||
————||
————||

——||||
——||||
————||
————||

——————
|——|——
|——|||
————||

——————
——||——
——||||
————||

||————
||||——
——||||
————||

——||——
||||——
||——||
————||

——|——|
|||——|
||——||
————||

————||
||——||
||——||
————||

||||||
||||||
————||
————||

————||
|——|||
|——|||
————||

——————
————||
——||||
——||——

||————
||——||
——||||
——||——

|——|——
|——|||
——||||
——||——

——||——
——||||
——||||
——||——

|————|
|——|||
——||||
——|——|

——|——|
——||||
——||||
——|——|

————||
——||||
——||||
————||

||||——
||||||
——||||
——||——

|||——|
||||||
——||||
——|——|

——————
||||——
||||||
————||

||——||
||||||
——||||
————||

——||||
||||||
||——||
————||

——————
——————
||||——
||||——

||————
||————
||||——
||||——

|——|——
|——|——
||||——
||||——

——||——
——||——
||||——
||||——

|————|
|————|
||||——
||||——

——|——|
——|——|
||||——
||||——

————||
————||
||||——
||||——

||||——
||||——
||||——
||||——

|||——|
|||——|
||||——
||||——

——————
||——||
||||||
——||——

||——||
||——||
||||——
||||——

|——|||
|——|||
||||——
||||——

——||||
——||||
||||——
||||——

——————
——||||
||||||
||————

||————
||||||
||||||
||————

|——|——
||||||
||||||
|——|——

——||——
||||||
||||||
——||——

|————|
||||||
||||||
|————|

——|——|
||||||
||||||
——|——|

————||
||||||
||||||
————||

||||||
||||||
||||——
||||——

——————
——————
|||——|
|||——|

||————
||————
|||——|
|||——|

|——|——
|——|——
|||——|
|||——|

——||——
——||——
|||——|
|||——|

|————|
|————|
|||——|
|||——|

——|——|
——|——|
|||——|
|||——|

————||
————||
|||——|
|||——|

||||——
||||——
|||——|
|||——|

|||——|
|||——|
|||——|
|||——|

||——||
||——||
|||——|
|||——|

|——|||
|——|||
|||——|
|||——|

——||||
——||||
|||——|
|||——|

||||||
||||||
|||——|
|||——|

——————
——————
||——||
||——||

||————
||————
||——||
||——||

|——|——
|——|——
||——||
||——||

——||——
——||——
||——||
||——||

|————|
|————|
||——||
||——||

——|——|
——|——|
||——||
||——||

————||
————||
||——||
||——||

||||——
||||——
||——||
||——||

|||——|
|||——|
||——||
||——||

||——||
||——||
||——||
||——||

|——|||
|——|||
||——||
||——||

——||||
——||||
||——||
||——||

||||||
||||||
||——||
||——||

——————
——————
|——|||
|——|||

||————
||————
|——|||
|——|||

|——|——
|——|——
|——|||
|——|||

——||——
——||——
|——|||
|——|||

|————|
|————|
|——|||
|——|||

——|——|
——|——|
|——|||
|——|||

————||
————||
|——|||
|——|||

||||——
||||——
|——|||
|——|||

|||——|
|||——|
|——|||
|——|||

||——||
||——||
|——|||
|——|||

|——|||
|——|||
|——|||
|——|||

——||||
——||||
|——|||
|——|||

||||||
||||||
|——|||
|——|||

——————
——————
——||||
——||||

||————
||————
——||||
——||||

|——|——
|——|——
——||||
——||||

——||——
——||——
——||||
——||||

|————|
|————|
——||||
——||||

——|——|
——|——|
——||||
——||||

————||
————||
——||||
——||||

||||——
||||——
——||||
——||||

|||——|
|||——|
——||||
——||||

——————
||————
||||||
——||||

||——||
||——||
——||||
——||||

|——|||
|——|||
——||||
——||||

——||||
——||||
——||||
——||||

——————
——||——
||||||
||——||

||————
||||——
||||||
||——||

|——|——
||||——
||||||
|——|||

——||——
||||——
||||||
——||||

|————|
|||——|
||||||
|——|||

——|——|
|||——|
||||||
——||||

————||
||——||
||||||
——||||

||||||
||||||
——||||
——||||

——————
————||
||||||
||||——

||————
||——||
||||||
||||——

|——|——
|——|||
||||||
||||——

——||——
——||||
||||||
||||——

|————|
|——|||
||||||
|||——|

——|——|
——||||
||||||
|||——|

————||
——||||
||||||
||——||

||||——
||||||
||||||
||||——

|||——|
||||||
||||||
|||——|

||——||
||||||
||||||
||——||

|——|||
||||||
||||||
|——|||

——||||
||||||
||||||
——||||

——————
——————
||||||
||||||

||————
||————
||||||
||||||

|——|——
|——|——
||||||
||||||

——||——
——||——
||||||
||||||

|————|
|————|
||||||
||||||

——|——|
——|——|
||||||
||||||

————||
————||
||||||
||||||

||||——
||||——
||||||
||||||

|||——|
|||——|
||||||
||||||

||——||
||——||
||||||
||||||

|——|||
|——|||
||||||
||||||

——||||
——||||
||||||
||||||

||||||
||||||
||||||
||||||

Input
There is no input -- you only have to print 4x6 tilings. In theory, you could hardcode an output, but that would likely take more bytes that producing it.
Output
Print the 281 tilings in any order in the format shown in the example, with each one appearing exactly once. There must be exactly one empty line between tilings. Any other whitespace is OK if it doesn't affect the visible output. Empty lines at the start and end are also OK.
Other requirements
Your code should not be horribly slow; it should produce output within 10 minutes, which should be ample time. Functions to produce or enumerate tilings are disallowed.
In case people are wondering if this is sufficiently distinct from Fibonacci Domino Tiling, I expect the answers to use a different strategies as one can no longer take advantage of the particular Fibonacci structure of 2-by-n domino tilings and them being specified by their top row.

CJam, 75 67 63 58 57 bytes
La'|a{_'|f+@:C"--"f++}5*\;_m*_m*{~+}%{zC{81f^}%-!},Nf+Nf*

Try it online.
Example run
$ cjam 4x6.cjam | head -9
||||||
||||||
||||||
||||||

||||||
||||||
--||||
--||||
$ cjam 4x6.cjam | tail -10
------
------
||----
||----

------
------
------
------

$ cjam 4x6.cjam | wc -l
1405
$ cjam 4x6.cjam | md5sum
83b5de42157ace906ed5c0173fb99027  -

Background
A covering of the rectangle by domino halves is a valid tiling if:

Horizontal domino halves occur in pairs in each row.
Vertical domino halves occur in pairs in each column.

The valid configurations for rows of length n can be obtained by adding a vertical domino half to the valid configurations for n - 1 and a two horizontal domino halves to the valid configurations for n - 2.
The valid configurations for columns of length n can be computed as the configurations of rows of the same length, exchanging vertical domino halves and horizontal domino halves.
To generate all 281 possible tilings, it suffices to generate all possible combinations of rows, all possible combinations of columns and intersect the two sets.
Implementation
Rather than generating combinations twice and intersecting, we can generate all possible combinations of rows and check if their columns have a valid pattern.
" Leave an array of valid row configurations of length 6 on the stack and save the valid
  row configurations of length 4 in C. In http://codegolf.stackexchange.com/a/38000,
  I explain in detail how this is achieved.                                               ";

La'|a{_'|f+@:C"--"f++}5*\;

" Compute the Cartesian product of four copies of the array.                              ";

_m*_m*

" Flatten the arrays of strings of the Cartesian product.                                 ";

{~+}%

" Transpose rows and columns, swap vertical bars and hyphens in C (note that ord('-') ==
 ord('-') ^ 81) and check if all rows of the first array belong to the second.            ";

{zC{81f^}%-!},

" Separate the rows of a tiling and the tilings from each other.                          ";

Nf+ Nf*

Cool, I wonder if this method would work in general. I see no reason why not. It would be interesting to check it on 5x5 and confirm it returns nothing. BTW, I have though of a massive improvement to my program (same philosophy as my current one, but different implementation) but I have no time to write it today. Don't worry, it will still be about twice as long as yours ;-D

After generating the possible rows and columns dynamically, this approach should work just fine in the general case. The row check makes sure all dashes occur in pairs, the column check does the same for bars. Since a valid row would have to contain an even amount of dashes and a valid column an even amount of bars, it would return nothing for 5x5.

Interesting, the idea of generating and intersecting is clever. I hadn't considered a partial hardcode like this.

@xnor: Turns out that generating the rows is even shorter.

C, 282 bytes ungolfed
i,j,p[4],q,t,a,b,c,d;
main(){
  char s[]="UTRQPJIHEDBA@";
  for(i=64*169;i--;){
    a=p[0]=s[i%13]*3,d=p[3]=s[i/13%13]*3,q=i/169;
    b=p[1]=p[0]&q;c=p[2]=p[3]&q;
    if((a|q)==255&(d|q)==255 & (b/3|b/3*2)==b & (c/3|c/3*2)==c)
      for(j=24;j--;)putchar(p[j/6]>>j%6&1?45:124),j%6||printf(j?"\n":" %d\n\n",t+=!j);
  }
}

This works in a similar way to my answer to the previous question, with 1 representing - and 0 representing |. In fact the 13 valid combinations for n=6 in the previous question are encoded in s[], having had binary 11000000 added to them to bring them into a convenient ASCII range, then divided by 3.
A logical way to proceed is to place the vertical dominoes that straddle the centreline, then place the remaining vertical dominoes, and finally place the horizontal dominoes. That's basically how my code proceeds. The 13x13=169 possible tilings with no vertical dominoes crossing the centreline are listed first, then the different combinations of vertical dominoes crossing the centreline are explored.
q contains the pattern for vertical centre dominoes (all 64 combinations of 1's and 0's are allowed in principle.) a and d store the top and bottom rows (only those 13 combinations from the previous question are allowed, as they are the only ones that give complete horizontal dominoes.) b and c hold the calculated values for the centre rows (made by ANDing q with a and  d) and the following rules are applied:
1: no vertical dominoes may overlap. a and d when ORed with q must give 11111111. (Remember due to the compression method, each domino in a and dis carrying an additional 11000000.)
2: rows b and c must hold complete horizontal dominoes. The code for checking this is (b/3|b/3*2)==b and is explained in my answer to the previous question.
output
in addition to a,b,c,d, the four rows are stored in an array p[] for printing via a loop. Currently each pattern is numbered. The numbering will be removed as part of the golfing process.
||||||
||||||
||||||
|||||| 1

||||||
||||||
||||--
||||-- 2

||||||
||||||
|||--|
|||--| 3

||||||
||||||
||--||
||--|| 4

||||||
||||||
||----
||---- 5

||||||
||||||
|--|||
|--||| 6

||||||
||||||
|--|--
|--|-- 7

||||||
||||||
|----|
|----| 8

||||||
||||||
--||||
--|||| 9

||||||
||||||
--||--
--||-- 10

||||||
||||||
--|--|
--|--| 11

||||||
||||||
----||
----|| 12

||||||
||||||
------
------ 13

||||--
||||--
||||||
|||||| 14

||||--
||||--
||||--
||||-- 15

||||--
||||--
|||--|
|||--| 16

||||--
||||--
||--||
||--|| 17

||||--
||||--
||----
||---- 18

||||--
||||--
|--|||
|--||| 19

||||--
||||--
|--|--
|--|-- 20

||||--
||||--
|----|
|----| 21

||||--
||||--
--||||
--|||| 22

||||--
||||--
--||--
--||-- 23

||||--
||||--
--|--|
--|--| 24

||||--
||||--
----||
----|| 25

||||--
||||--
------
------ 26

|||--|
|||--|
||||||
|||||| 27

|||--|
|||--|
||||--
||||-- 28

|||--|
|||--|
|||--|
|||--| 29

|||--|
|||--|
||--||
||--|| 30

|||--|
|||--|
||----
||---- 31

|||--|
|||--|
|--|||
|--||| 32

|||--|
|||--|
|--|--
|--|-- 33

|||--|
|||--|
|----|
|----| 34

|||--|
|||--|
--||||
--|||| 35

|||--|
|||--|
--||--
--||-- 36

|||--|
|||--|
--|--|
--|--| 37

|||--|
|||--|
----||
----|| 38

|||--|
|||--|
------
------ 39

||--||
||--||
||||||
|||||| 40

||--||
||--||
||||--
||||-- 41

||--||
||--||
|||--|
|||--| 42

||--||
||--||
||--||
||--|| 43

||--||
||--||
||----
||---- 44

||--||
||--||
|--|||
|--||| 45

||--||
||--||
|--|--
|--|-- 46

||--||
||--||
|----|
|----| 47

||--||
||--||
--||||
--|||| 48

||--||
||--||
--||--
--||-- 49

||--||
||--||
--|--|
--|--| 50

||--||
||--||
----||
----|| 51

||--||
||--||
------
------ 52

||----
||----
||||||
|||||| 53

||----
||----
||||--
||||-- 54

||----
||----
|||--|
|||--| 55

||----
||----
||--||
||--|| 56

||----
||----
||----
||---- 57

||----
||----
|--|||
|--||| 58

||----
||----
|--|--
|--|-- 59

||----
||----
|----|
|----| 60

||----
||----
--||||
--|||| 61

||----
||----
--||--
--||-- 62

||----
||----
--|--|
--|--| 63

||----
||----
----||
----|| 64

||----
||----
------
------ 65

|--|||
|--|||
||||||
|||||| 66

|--|||
|--|||
||||--
||||-- 67

|--|||
|--|||
|||--|
|||--| 68

|--|||
|--|||
||--||
||--|| 69

|--|||
|--|||
||----
||---- 70

|--|||
|--|||
|--|||
|--||| 71

|--|||
|--|||
|--|--
|--|-- 72

|--|||
|--|||
|----|
|----| 73

|--|||
|--|||
--||||
--|||| 74

|--|||
|--|||
--||--
--||-- 75

|--|||
|--|||
--|--|
--|--| 76

|--|||
|--|||
----||
----|| 77

|--|||
|--|||
------
------ 78

|--|--
|--|--
||||||
|||||| 79

|--|--
|--|--
||||--
||||-- 80

|--|--
|--|--
|||--|
|||--| 81

|--|--
|--|--
||--||
||--|| 82

|--|--
|--|--
||----
||---- 83

|--|--
|--|--
|--|||
|--||| 84

|--|--
|--|--
|--|--
|--|-- 85

|--|--
|--|--
|----|
|----| 86

|--|--
|--|--
--||||
--|||| 87

|--|--
|--|--
--||--
--||-- 88

|--|--
|--|--
--|--|
--|--| 89

|--|--
|--|--
----||
----|| 90

|--|--
|--|--
------
------ 91

|----|
|----|
||||||
|||||| 92

|----|
|----|
||||--
||||-- 93

|----|
|----|
|||--|
|||--| 94

|----|
|----|
||--||
||--|| 95

|----|
|----|
||----
||---- 96

|----|
|----|
|--|||
|--||| 97

|----|
|----|
|--|--
|--|-- 98

|----|
|----|
|----|
|----| 99

|----|
|----|
--||||
--|||| 100

|----|
|----|
--||--
--||-- 101

|----|
|----|
--|--|
--|--| 102

|----|
|----|
----||
----|| 103

|----|
|----|
------
------ 104

--||||
--||||
||||||
|||||| 105

--||||
--||||
||||--
||||-- 106

--||||
--||||
|||--|
|||--| 107

--||||
--||||
||--||
||--|| 108

--||||
--||||
||----
||---- 109

--||||
--||||
|--|||
|--||| 110

--||||
--||||
|--|--
|--|-- 111

--||||
--||||
|----|
|----| 112

--||||
--||||
--||||
--|||| 113

--||||
--||||
--||--
--||-- 114

--||||
--||||
--|--|
--|--| 115

--||||
--||||
----||
----|| 116

--||||
--||||
------
------ 117

--||--
--||--
||||||
|||||| 118

--||--
--||--
||||--
||||-- 119

--||--
--||--
|||--|
|||--| 120

--||--
--||--
||--||
||--|| 121

--||--
--||--
||----
||---- 122

--||--
--||--
|--|||
|--||| 123

--||--
--||--
|--|--
|--|-- 124

--||--
--||--
|----|
|----| 125

--||--
--||--
--||||
--|||| 126

--||--
--||--
--||--
--||-- 127

--||--
--||--
--|--|
--|--| 128

--||--
--||--
----||
----|| 129

--||--
--||--
------
------ 130

--|--|
--|--|
||||||
|||||| 131

--|--|
--|--|
||||--
||||-- 132

--|--|
--|--|
|||--|
|||--| 133

--|--|
--|--|
||--||
||--|| 134

--|--|
--|--|
||----
||---- 135

--|--|
--|--|
|--|||
|--||| 136

--|--|
--|--|
|--|--
|--|-- 137

--|--|
--|--|
|----|
|----| 138

--|--|
--|--|
--||||
--|||| 139

--|--|
--|--|
--||--
--||-- 140

--|--|
--|--|
--|--|
--|--| 141

--|--|
--|--|
----||
----|| 142

--|--|
--|--|
------
------ 143

----||
----||
||||||
|||||| 144

----||
----||
||||--
||||-- 145

----||
----||
|||--|
|||--| 146

----||
----||
||--||
||--|| 147

----||
----||
||----
||---- 148

----||
----||
|--|||
|--||| 149

----||
----||
|--|--
|--|-- 150

----||
----||
|----|
|----| 151

----||
----||
--||||
--|||| 152

----||
----||
--||--
--||-- 153

----||
----||
--|--|
--|--| 154

----||
----||
----||
----|| 155

----||
----||
------
------ 156

------
------
||||||
|||||| 157

------
------
||||--
||||-- 158

------
------
|||--|
|||--| 159

------
------
||--||
||--|| 160

------
------
||----
||---- 161

------
------
|--|||
|--||| 162

------
------
|--|--
|--|-- 163

------
------
|----|
|----| 164

------
------
--||||
--|||| 165

------
------
--||--
--||-- 166

------
------
--|--|
--|--| 167

------
------
----||
----|| 168

------
------
------
------ 169

||||--
||||||
||||||
||||-- 170

||||--
||||||
||--||
||---- 171

||||--
||||||
|--|||
|--|-- 172

||||--
||||||
--||||
--||-- 173

||||--
||||||
----||
------ 174

||----
||--||
||||||
||||-- 175

||----
||--||
||--||
||---- 176

||----
||--||
|--|||
|--|-- 177

||----
||--||
--||||
--||-- 178

||----
||--||
----||
------ 179

|--|--
|--|||
||||||
||||-- 180

|--|--
|--|||
||--||
||---- 181

|--|--
|--|||
|--|||
|--|-- 182

|--|--
|--|||
--||||
--||-- 183

|--|--
|--|||
----||
------ 184

--||--
--||||
||||||
||||-- 185

--||--
--||||
||--||
||---- 186

--||--
--||||
|--|||
|--|-- 187

--||--
--||||
--||||
--||-- 188

--||--
--||||
----||
------ 189

------
----||
||||||
||||-- 190

------
----||
||--||
||---- 191

------
----||
|--|||
|--|-- 192

------
----||
--||||
--||-- 193

------
----||
----||
------ 194

|||--|
||||||
||||||
|||--| 195

|||--|
||||||
|--|||
|----| 196

|||--|
||||||
--||||
--|--| 197

|----|
|--|||
||||||
|||--| 198

|----|
|--|||
|--|||
|----| 199

|----|
|--|||
--||||
--|--| 200

--|--|
--||||
||||||
|||--| 201

--|--|
--||||
|--|||
|----| 202

--|--|
--||||
--||||
--|--| 203

||----
|||--|
|||--|
||---- 204

||----
|||--|
--|--|
------ 205

------
--|--|
|||--|
||---- 206

------
--|--|
--|--|
------ 207

||--||
||||||
||||||
||--|| 208

||--||
||||||
||||--
||---- 209

||--||
||||||
--||||
----|| 210

||--||
||||||
--||--
------ 211

||----
||||--
||||||
||--|| 212

||----
||||--
||||--
||---- 213

||----
||||--
--||||
----|| 214

||----
||||--
--||--
------ 215

----||
--||||
||||||
||--|| 216

----||
--||||
||||--
||---- 217

----||
--||||
--||||
----|| 218

----||
--||||
--||--
------ 219

------
--||--
||||||
||--|| 220

------
--||--
||||--
||---- 221

------
--||--
--||||
----|| 222

------
--||--
--||--
------ 223

||----
||||||
||||||
||---- 224

||----
||||||
--||||
------ 225

------
--||||
||||||
||---- 226

------
--||||
--||||
------ 227

|----|
||--||
||--||
|----| 228

|--|||
||||||
||||||
|--||| 229

|--|||
||||||
||||--
|--|-- 230

|--|||
||||||
|||--|
|----| 231

|--|--
||||--
||||||
|--||| 232

|--|--
||||--
||||--
|--|-- 233

|--|--
||||--
|||--|
|----| 234

|----|
|||--|
||||||
|--||| 235

|----|
|||--|
||||--
|--|-- 236

|----|
|||--|
|||--|
|----| 237

|--|--
||||||
||||||
|--|-- 238

|----|
||||||
||||||
|----| 239

------
|----|
|----|
------ 240

----||
|--|||
|--|||
----|| 241

----||
|--|||
|--|--
------ 242

------
|--|--
|--|||
----|| 243

------
|--|--
|--|--
------ 244

------
|--|||
|--|||
------ 245

--||||
||||||
||||||
--|||| 246

--||||
||||||
||||--
--||-- 247

--||||
||||||
|||--|
--|--| 248

--||||
||||||
||--||
----|| 249

--||||
||||||
||----
------ 250

--||--
||||--
||||||
--|||| 251

--||--
||||--
||||--
--||-- 252

--||--
||||--
|||--|
--|--| 253

--||--
||||--
||--||
----|| 254

--||--
||||--
||----
------ 255

--|--|
|||--|
||||||
--|||| 256

--|--|
|||--|
||||--
--||-- 257

--|--|
|||--|
|||--|
--|--| 258

--|--|
|||--|
||--||
----|| 259

--|--|
|||--|
||----
------ 260

----||
||--||
||||||
--|||| 261

----||
||--||
||||--
--||-- 262

----||
||--||
|||--|
--|--| 263

----||
||--||
||--||
----|| 264

----||
||--||
||----
------ 265

------
||----
||||||
--|||| 266

------
||----
||||--
--||-- 267

------
||----
|||--|
--|--| 268

------
||----
||--||
----|| 269

------
||----
||----
------ 270

--||--
||||||
||||||
--||-- 271

--||--
||||||
||--||
------ 272

------
||--||
||||||
--||-- 273

------
||--||
||--||
------ 274

--|--|
||||||
||||||
--|--| 275

------
|||--|
|||--|
------ 276

----||
||||||
||||||
----|| 277

----||
||||||
||||--
------ 278

------
||||--
||||||
----|| 279

------
||||--
||||--
------ 280

------
||||||
||||||
------ 281

Very interesting and unique approach, as usual. The bit magic from this and your other answer is nothing short of amazing!

C, 216 bytes
#define M:++B:++B:8;for(k=0
j,k,B;char*c,s[99];main(i){for(i<<=24;i--;B||puts(s)){for(B=k=0;j=i>>k++;)j&1?k%6?j&2?k++M;k^29;k+=6)j=~i>>(k-=k/24*23),j&1?k<18?j&64?k+=6
M,c=s;k<24;++k%6||(*c++=10))*c++=1<<k&i?45:'|';}}

Sadly it took over 200 bytes. My approach was to view the grid as 24 bits which can each be either part of a horizontal piece or part of a vertical piece. It generates all 1<<24 combinations and then goes down the rows and columns munching the dominos to see whether each one is valid.

How long does it take to run with 16 million or so combinations?

@xnor It was taking about 10 seconds, without optimizations enabled.

Python 2: 130 bytes
for i in range(4096):
 G=([0]*6+["\n"])*4;exec"b=i%2;j=G.index(0);G[j]=G[(j+7**b)%28]='-|'[b];i/=2;"*12
 if all(G):print"".join(G)

I use a different encoding of tilings than has been posted so far, one that is more efficient timewise in that it needs only 12 bits to represent a valid tiling, though in retrospect perhaps not the golfiest one.
If you "read" through the 4x6 grid from left to right, top to bottom, each domino you encounter in order is either vertical or horizontal. (Of course, you encounter each domino twice, but only the first encounter of the top or left corner matters). This gives a sequence of 12 bits.
For example, the tiling
——|——|
|||——|
||||——
——||——

corresponds to HVHVVVVHVHHH.
Conversely, each sequence of 12 corresponds to a unique tiling, created by repeatedly adding a tile of the specified orientation with it's top or right cell as the first unoccupied cell in reading order. Some, though, are not legal tilings because a domino is placed with its other half off the board or overlapping with an existing domino.
The code tries every possible sequence, represented by a 12-bit number 0 to 4095, reading off bits one at a time with %2 and /2. The board, initialized with zeroes for empty cells, is stored with rows concatenated into a single list. That way, it's easy to find the first zero element to place the domino. The other domino half is either one row or column down, and so found by adding 1 or 6 to the index. These two cells are filled with the proper character - or |. This list could have been a string except that Python strings are immutable.
Rather than checking for a collision, we place the dominoes allowing overlaps, and see at the end whether the board is filled by whether any zeroes remain (all). We actually make the board 4x7, filling the right row with \n for two reasons. The first is that the padding lets horizontal dominoes go off the end without cycling over to the left edge (dominoes that go off the bottom edge are wrapped around with %28, but that's fine because they overlap with the the first row which has been filled by then). The other reason is so that in a legal configuration, the newlines remain and cause the lines to be printed separately when the characters are joined.

Very interesting approach! Since this iterates through much less coverings than my algorithm, I expected it to be a lot faster. However, your code takes 1.14 s with CPython (2.66 s with PyPy) on my machine, while my CJam code takes only 0.35 s. I wonder why...

@Dennis That is surprising. I was going to say that maybe printing dominates the running time, except removing printing doesn't make it faster. Maybe Python is really just that slow. Having written this, I had not expected a 2**24 algorithm to fit within the time limit.

Eliminating the print line was the first thing I tried. exec is the culprit. With a loop, it runs in 0.08 seconds.

@Dennis Oh, nice find. So perhaps repeatedly calling the interpreter at runtime is eating up all of the time. Also, the loop time extrapolates to ~5 minutes for 2**24 tilings, so looping over these was probably viable, though I'd need to think about efficiency.

Seeing how the search space can be reduced ao effectively, I think n*m tilings would make a nice fastest-code challenge.

@Dennis That does sound like in interesting challenge. You're welcome to take it -- I wouldn't know how to spec such a thing.

It would be my first challenge ever, but I'll give it a try. I'll post a draft in the sandbox tommorow.

Longest 24 hours of my life. Let me know what you think.

source: Stack Exchange

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

sort: votes


text:
Writing Phrases with Code
This is my first contest, so please tell me what I can do to improve.
The object of this contest is to write program lines in your language of choice that are both valid code and self-descriptive in English, such as this Golfscript program:
This program outputs 4 twice.

You may use any language features, libraries, #defines, etc. that you want; however, a setup must not be over 10 lines (no, you can't cheat using ; or any such line separator :P).
The program with the most upvotes by midnight on October 1st wins.

I'd say you may want to reword 'Must not be over 10 lines' since technically a full-blown program can be on one continuous line. Maybe adding a character restriction per line or overall character limit.

I'm not sure what the line limit is going to accomplish. As a fellow GolfScriptling, you know hat some languages aren't even organized by lines. 2. Self-descriptive code is the exact opposite of obfuscation. 3. The code-challenge tag is only for questions that are not covered by code-golf, popularity-contest, etc.

is any language allowed?

This was a bad idea from the start, I'll admit. I just wanted to do something like the "aphorism" challenge, but I didn't want a duplicate.

Python
# This "program" does nothing and assumes "valid code" means it doesn't throw an error.

You might want to tighten up the rules a bit.

C
This was too easy...
#define This int
#define program main(){
#define prints printf(
#define and );
#define exits }

This program prints "Hello world!" and exits

English
This program outputs 99 verses in the manner:
"N bottles of beer on the wall
N bottles of beer
Take one down and pass it around
N-1 bottles of beer on the wall",
where N is replaced by numbers from 99 to 1
and 1-1=0 is replaced by "No more".
After that there is hundredth verse:
"No more bottles of beer on the wall
No more bottles of beer
Go to the store and buy some more
99 bottles of beer on the wall".

OS X say
say whatever you want man!

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


text:
Anagramming Code
Let's try this again.
The object of this contest is to make two pieces of code that are anagrams of each other (the two must contain the same bytes in a different order), and they will do the following tasks:

One must test if an inputted number is happy or prime, and output if the number is either (for example, 7 must output happy prime and 4 must output sad non-prime).
The other must output its code size in bytes as a word (a 60-byte program would output sixty, a 39-byte program would output thirty-nine).

If any clarification is needed on the rules, don't hesitate to tell me.
This is a code golf competition, so shortest program wins!

What prevents one from doing /*program1*/program2 and then program1/*program2*/? I think you should disallow comments.

@WilliamBarbosa Why? That will hardly be an optimal solution.

But you could also share some parts and not share others which makes it much easier

@proudhaskeller Banning comments doesn't solve that though. You can always stuff characters into strings, variable names or parts of the code that aren't executed for other reasons.

Can a 60 length program print sixTY instead of sixty (Basically asking if the output should be in all lowercaps or not) ?

Output is case insensitive.

FWIW, I don't think you should have deleted your own submission. OP or not, it was an interesting answer.

Undeleting now.

CJam, 80 49 48 characters
UPDATE : Inspired by Dennis' implementation to calculate sum of squares of digits, here is a shorter version
Happy/Sad Prime/Non-prime:
ri:T{Ab2f#:+}G*X="happy""sad"?STmp4*"non-prime">

How it works:
ri:T                                "Read input as integer and store it in T"
    {       }G*                     "Run this code block 16 times"
     Ab                             "Convert the number into base 10"
       2f#                          "Calculate square of each digit"
          :+                        "Sum all the squared digits and put the sum on stack"
X=                                  "Compare the sum after 16th iteration to 1"
  "happy""sad"?                     "If sum is 1, put `happy` to stack, otherwise `sad`"
               ST                   "Put space on stack then put the value of T on stack"
                 mp4*               "Put 4 to stack if input is prime, otherwise 0"
                     "non-prime">   "Put `non-prime` to stack and slice out first four characters if the input number is prime"

forTy-eiGhT
""A"forTy-eiGhT""ri:{b2#:+}*X=appsadSmp4*nnpm>"?

How this works:
""                                  "Push empty string to stack"
  A                                 "Push 10 to stack"
   "forTy-eiGhT"                    "Push `forTy-eiGhT` to stack"
                "ri:....pm>"        "Push this string to stack too"
                            ?       "Keep `forTy-eiGhT` on stack and pop the other string"

Try it online
The first program reads the number from STDIN

My original 80 character solution
Happy/Sad Prime/Non-prime:
r:N{1/~]{i_*T+:T;}/T_s\1=:H!X):XK<&0:T;}g;H"happy""sad"?SNimp"prime"_"non-"\+?:Y

eigHTY
"eigHTY""r:N{1/~]{i_*T+:T}/_s\1=:H!X):XK<&0:T}happysad?SNmp";"prim_";"non-\?:+";

CJam, 50 49 bytes
Happiness and primality test
li_{Ab2f#:+}30*(T="happy""sad"?S@mp4*"non-prime">

Reads a number from STDIN. Both tests work only for 64-bit integers.
Try it online.
Own length
A"forTy-nine""l_{b2#:+}30*(=happsadS@mp4*pim>"?""

Prints forTy-nine.

+1 for the 31-byte improvement, and "forTy-nine".

Golfscript - 81
This program tests if a number is happy and/or prime.
~.:a;0.{).a\%!@+\}a*;2="""non-"if"prime"@ {`0\{48-.*+}/}9*("sad ""happy "if@@#get

This program, an anagram of the last, outputs "eighty-one" (its bytesize as a word).
;"eighty-one"#   !""""""""%()***++-..../002489:;=@@@@\\\`aaaaadffiimnppprs{{{}}}~

This should serve as an example.

Hm, providing a reference implementation for a code golf challenge in GolfScript might not be the best idea. I believe this one is quite difficult to beat and hence slightly disheartening for participants.

I see people are not noticing you wrote the question and upvoting you... I totally agree with martin.

@proudhaskeller There is absolutely nothing wrong with self-answering.

I say there is nothing wrong with answering myself or commented code.

@JosiahWinslow There is nothing wrong with it. I'm just saying, you might be missing out on some interesting longer answers if you post a very good solution yourself right away.

J - 87 char
A naive attempt at this in J. No use of the standard library, though I doubt it would get any shorter by using that.
((sad`happy{~1 e.(,[:+/@:*:,.&.":@{:)^:(1-{:e.}:)^:_);@,' ';'gtv]non-prime'}.~4+4*1&p:)
'((ad`app{~1 .(,[:+/@:*:,.&.":@{:)^:(1-{:.}:)^:_);@, ;onprm}.~4+4*1&p:)']'eighty-seven'
('(ad`app{~1 .(,[:+/@:*:,.&.:@{:)^:(1-{:.}:)^:);@, ;onprm}.~4+4*1&p:']'eighty-seven'"_)

The line on the top is a verb taking an integer and diagnosing its happiness and primality as an output string. The second line is an expression returning the string eighty-seven, while the third is a constant function doing the same. I included both because they were both possible and because I don't know what the ruling will be on function answers as opposed to program ones, and J doesn't have such a thing as no-argument functions—you just give a function a dummy argument.
We lose most of the chars checking for happiness. (,[:+/@:*:,.&.":@{:) is the main body that sums the squares of the digits of a number, and (1-{:e.}:) is the test of whether that number has occurred yet. sad`happy{~1 e. turns this into a word result, and we attach that to the front of the string non-prime, potentially snipping off four characters if the number was actually prime.
In the anagram we just hide all the bits that aren't 'eighty-seven' in a string that we ignore. I could do better if J had more letters to reuse, but it doesn't, so oh well.

That's a good solution.


text:
The color spelling game
In the color spelling game, you are shown a list of color names, but rather than reading the words that are written, you have to say the name of the color of the letters. The game is over as soon as you say the wrong color, and the player who spelled the most words correctly wins. To make the game more challeging, each word is written on a different background color.
And here is your challenge:
Write a program that creates a color spelling game.

Print every second or so the name of a color.
Use different colors for the background and the foreground.
The name of the color you print should be different than both the background and the foreground.
Do not repeat the same color name, foreground or background color in two consecutive rows. It's still ok to reuse the same color in succession for different purposes, like printing the word "red" after a word on a red background.
Choose each color (pseudo)randomly from a palette of at least 6 colors.
Use a programming language of your choice.

Here is my solution for JavaScript, change as you like: http://jsfiddle.net/xb8rqsbr/
This is a code golf challenge, so keep your code short.
Have fun!

Why is this a popularity contest? This is quite strictly specified, so where is the room for creativity? Why not make it a simple code golf?

Where does spelling appear?  Isn't it a color reading task, known as the Stroop Word-Color test?

Now there's a problem with code-golf: what colors do we need to support? Or may we encode a list for free and have to support any size of the list?

@JanDvorak you don't need to support any specific color, but the code should work without input, so the color list should be somehow predefined.

BBC Basic, 187 176 ASCII characters, tokenised filesize 155 140
Download emulator at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html
Saved some characters: instead of using MOD to always generate random numbers that differ than the previous value, I simply generate any number and perform a check instead.
b=0f=0w=0REPEATc=b g=f x=w REPEATb=RND(6)f=RND(6)w=RND(6)UNTIL(b-f)*(f-w)*(w-b)*(b-c)*(f-g)*(w-x)VDU17,b+128,17,f:PRINTMID$("Red LimeGoldBluePinkAqua",w*4-3,4):WAIT 99UNTIL0

I used the original BBC Basic 3-bit colour codings, which are based on 1's bit=Red, 2's bit=Green, 4's bit=Blue. I renamed Yellow as Gold, Magenta as Pink and Green as Lime (justifiable given the shade produced) in order to shorten colour names. I also renamed Cyan as Aqua just because. Therefore I use colours 1 to 6 from the 3-bit scheme. I exclude 0=black and 7=white (a very light grey, as the full white belongs to the extended 16-colour set in which the 8`s bit refers to brightness.)
b=0 f=0 w=0                                     :REM initialise "old" values for background, foreground and word.
REPEAT
  c=b g=f x=w                                   :REM c,g and x contain the old values for background, foreground and word.
  REPEAT
    b=RND(6)f=RND(6)w=RND(6)                    :REM pick random numbers between 1 and 6
  UNTIL(b-f)*(f-w)*(w-b)*(b-c)*(f-g)*(w-x)      :REM until all colours are different from each other and their previous values
  VDU17,b+128,17,f,12                           :REM VDU 17 sets colour, using the 128's bit to say if it is foreground or background. VDU 12 clears the screen.
  PRINTMID$("Red LimeGoldBluePinkAqua",w*4-3,4) :REM MID$ picks the colour. The string is considered 1-indexed.
  WAIT 99                                       :REM wait 99 centiseconds
UNTIL0

Output
The first few images show the program as written, running in screen mode 6. The bottom image shows the program with the ,12 removed so that the screen is not cleared in between word printings. That way it is easier to verify that the colours comply with the rules.

Algoid - 349
Although Algoid isn't the best for golfing, it's perfect for these types of challenges.
set x=math.random;set m;while(true){set c=array{{"black",0},{"brown",6},{"blue",8},{"green",10},{"red",12},{"yellow",14},{"white",15}};set l=c.length();algo.clear();algo.hide();set b=0;set t=0;set w=0;while(b==t||w==t||b==w){b=c[x(l-1)];t=c[x(l-1)];w=c[x(l-1)]}if(m!=w){algo.setColor(t[1]);algo.setBgColor(b[1]);algo.text(w[0]);util.wait(2000);m=w}}

Example outputs

JavaScript ES6 - 163
Test on Firefox console. I'll try golfing it more later.
setInterval(s=>{c="Red0Lime0Gold0Blue0Pink0Aqua".split(0);r=x=>c.splice(~~(Math.random()*9)%c.length,1);console.log('%c'+r(),'background:'+r()+';color:'+r())},999)

"Print every second or so" - if anyone isn't fond of 999, then 1e3 also works.

Ruby 165
x,y,z=9
loop{f,b,t=(0..5).to_a.sample 3
x!=f&&y!=b&&z!=t&&(puts %W{\e[0 \e[3#{f} \e[4#{b} #{%w/black red green brown blue magenta/[t]}}.join ?m
sleep 1
x,y,z=f,b,t)}

Screenshot:

Python - 260
Not amazing, but it works
from random import randint
ps = ['pink','green','yellow','red'];cs=['\033[94m','\033[92m','\033[93m','\033[91m']
print "1 pink, 2 green, 3 yellow, 4 red"
while True:
    c=randint(0,3);p=randint(0,3);g=raw_input(cs[c]+ps[p]+'\033[0m')
    if int(g)!=c+1:
        exit()


text:
The World in the Future
In the future, the world will change, there's no doubt about it. For that reason, you have to produce a realistic map of the world n years in the future.
The number n should be the number of years in the future and can be input via STDIN or argv.
It can be one of four types of maps: satellite (real colours), geographical (showing terrain), geological (showing terrain and rock types) or ecological (showing the type of ecosystem in that area - desert, forest, tundra etc).
For a map to be realistic, you cannot add in things such as 'alien invasions' and complete and utter apocalyptic obliterations of the planet. That doesn't mean that you can't factor in meteorite and asteroid impacts (it needs to keep the world round and spinning though).
If n is supplied as a negative value, you must not simulate the Earth in the past. Instead, take the absolute value and find the Earth in the future.
The program with the most upvotes wins, so remember to include all the bells and whistles. Please include example outputs for n=1000, n=10000, n=1000000 and n=100000000.
Note that your map must be on a world big enough to distinguish details easily.
Examples
Satellite, n=100000000

Geological, n=250000000

Ecological, n=0

Note: It is very hard to find suitable maps of the predicted Earth, so please excuse me if the examples are not up to scratch

I think that restricting this to providing maps of future continents (i.e. tectonics), biome maps (e.g. desert spread) or maps of sea level rise will help make this more objective. The politics is too unpredictable to make a good question

Maybe "Your program has to be 2048 bytes or less", "No hardcoding", "Most accurate match with " wins, [tag:code-challenge]???

I've played a lot with vector maps - most recently http://www.ludumdare.com/compo/ludum-dare-30/?action=preview&uid=10313 - and just compressing a vector map would be a great challenge.  Rendering a globe to PPM given a LNG/LAT for the centre point would be a great code golf.  The vector file can be supplied as part of the contest, so everyone is trying to shrink the same data.

Getting closer and closer, BetaDecay. Don't lose hope.

To describe plate motions you need at the very least shapefiles containing the coordinates of each plate boundaries as well as the Euler poles of those plates. To map the sea level you need topographical data, i. e. 3-dimensional coordinates of enough points in the world to be able to extrapolate, but you also need to be able to account for erosion and subsidence (on top of accounting for sea level itself of course). As a geoscientist, I found this challenge way too complex and broad, I'm sorry.

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


text:
It’s time to do the math
Introduction
This is one of my favorite math puzzles.
Given a digit (say 3) and the number of times to use that digit (say 5), generate 10 expressions which result to 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 using just +, −, ×, ÷, ^ and √ (root) (brackets are allowed to group operations).
For example:
(3^3 + 3)/(3 + 3) = (33 - 3)/(3 + 3) = 3 + 3/3 + 3/3 = 5

Note that all of the above use five 3’s and the mathematical operations and result to 5. You can also use a 3 before √ to denote a cube root. Same goes for using 4 before √ to denote a fourth root.
Also note that two 3’s can be used to form 33, or three 3’s can be used to form 333 and so on.
Challenge

You will be given two numbers (both ranging from 1 to 5) as a function argument, STDIN or command line argument.
The first number denotes which digit to use and the second number denotes the number of times that digit is to be used in the expression.
Your program should output an array of size 10 (or 10 space-separated numbers) where each element denotes whether a mathematical expression (using just the allowed operators) resulting into the (index + 1) number is possible or not using a truthy/falsy value.

For example, if the input is
1 3

Then the output should be
[1, 1, 1, 0, 0, 0, 0, 0, 0, 1]

because only 1, 2, 3 and 10 can be expressed using three 1’s.
Score

This is a code-golf so the minimum code length in bytes wins.

Bonus
Print-em-all [−50]
Subtract 50 from your score if the output array elements are equal to the total number of plausible combinations to get the (index + 1) value instead of truthy or falsy values.
For example, if there are only 3 possible combinations of five 3’s which result to 5, then the output array’s 4th entry should be 3.
Extreme Maths [−100]
Subtract 100 from your score if the output array elements contain at least one of the actual expressions which result to the (index + 1) value.
For example, if using five 3’s, the output array’s 4th entry can be either (3^3 + 3)/(3 + 3), (33 - 3)/(3 + 3) or 3 + 3/3 + 3/3
Overkilled [−200]
Subtract 200 from your score if the output array elements contain all possible combinations (separated by |). This bonus is added on top of the Extreme Maths bonus, so you get −300 in total.
For example, if using five 3’s, the output array’s 4th element should be (3^3 + 3)/(3 + 3)|(33 - 3)/(3 + 3)|3 + 3/3 + 3/3
Note: Any two expressions to achieve the same result should be logically different with a different approach in both of them.
For instance, to get 5 using five 3’s, 3 + 3/3 + 3/3 is same as 3/3 + 3 + 3/3 or 3/3 + 3/3 + 3 because the same approach is taken for each of them. (3^3 + 3)/(3 + 3) and (33 - 3)/(3 + 3) differ, as the 30 in the numerator is achieved via different approaches.
UPDATE : After going through all answers, it was found that all answers had imperfections due to edge cases of unary - and √. Thus, missing those edge cases was considered okay as far as completeness of answers is involved.
This is a tough question, but a rather interesting one.
Happy golfing!

I'm sorry, this may be dumb, but how do you get 10 with only three 1s?

@FryAmTheEggman 11-1

Ah, so  I was dumb :p

Related: http://codegolf.stackexchange.com/questions/32085/generate-all-possible-integers

Since there are only 25 cases, can I encode all the possible results in the code?

@Ray - There are definitely more than 25 cases. You can have digits 1 to 5 which can be used one to five times and in each of the combination, it can have multiple ways to form the result 1 to 10. So the total cases would be around 250.

Integer math or floating point?

Anyway to get to the resultant 1 to 10 value.

The -50 and -200 bonuses are poorly specified. What makes one expression distinguishable from another?

The expressions should be logically different. As in the approach taken should be different.

That's a very vague rule. I may decide that the square root of 1, the square root of the square root of 1, etc. are all different approaches and I have an infinite number of answers. Is a+b different from b+a? Is (-a) * (-b) different from b * a?

I have added more details in the question now. In short, all of your examples are similar. Since this is a maths puzzle, think of the answer from a mathematical POV and not as a string or some Permutation or Combination.

Do we really have to account for multiple consecutive square root operators? Because due to things like 2 = √√√√√√…√(4^(4^(4^(4^4)))), any program going for print-em-all or overkill would be untestable or chanceless because it would have to cover these things as special cases. (In general, I would have such a nice solution, if it weren’t for the root operator.)

Given that you have only limited number of 4, the number of √ required are also limited. Thus, there will be only a few (I can count if you want) such cases.

I am aware of this, but I cannot represent 4^(4^(4^(4^4))) in any regular number format – storing 4^(4^(4^4)) as an integer already needs more bits than there are atoms in the universe). So unless I use a computer algebra system capable of handling such numbers (if one exists at all), I need to treat these as special cases. This however almost certainly requires more characters than I win by overkilled. Therefore these awards are pointless unless you somewhat exclude multiple square roots.

I don't think that the actual answer will actually involved evaluation of the expressions at all. My hunch is that it will be more on the playing around with proper combination of symbols rather than looping and evaluating things.
That being said, I do think that roots are a bit dangerous here.

How exactly do you expect people to play around with the expressions without implementing their own CAS, which is certainly overkill?

Let us continue this discussion in chat.

Since this appeared in every answer so far: Do we need to consider the unary minus?

Hmm, now an answer is accepted which clearly does not match the challenge. But as the bounty is attributed, I can now vote to close.

@Wrzlprmft All answers were imperfect. And keeping asides the edges cases of unary -, and roots, I went with the answer with the best score. In fact, your answer would hang on me every single time for things above 3,3 .

Python 3 (imperfect), 449 - 300 = 149
Suffers from all the same shortcomings as KSab's solution: no unary operators, fully parenthesized, contains equivalent expressions like (1+1)+1 and 1+(1+1). I eliminated exact duplicates by passing the results to set(). The output could be a bit uglier to save a few bytes, but I like it this way. I also didn't do nth roots because it doesn't seem like they buy you much in this problem.
R=range
E=lambda z:eval(z.replace("^","**"))
def m(d,n):_=R(1,11);s={i:[]for i in _};r=R(1,n);n<2 and s[d].append(str(d));d=str(d);t=[[(d*i,i)for i in r]]+[[]]*n;h=[];[(h.append("("+A+o+B+")"),t[l].append((h[0],a+b))if a+b<n else E(*h)in _ and s[E(*h)].append(h[0]),h.pop())for l in r for j in R(l)for A,a in t[j]for k in R(l)for B,b in t[k]if a+b<=n for o in"+-*/^"if(o=="^"and-~-(0<E(B)<9)or 0==E(B)and"/"==o)-1];[print(i,set(s[i])or'')for i in _]

This will take several minutes to run if the second argument is 5. Test by calling m(digit, number):
>>> m(1,3)
1 {'((1*1)^1)', '(1^(1+1))', '((1-1)+1)', '((1/1)/1)', '((1*1)*1)', '((1^1)/1)', '(1*(1*1))', '(1^(1*1))', '(1+(1-1))', '(1^(1^1))', '((1^1)*1)', '(1^(1/1))', '((1/1)*1)', '(1-(1-1))', '(1/(1^1))', '(1/(1*1))', '(1/(1/1))', '(1*(1^1))', '((1+1)-1)', '((1*1)/1)', '((1^1)^1)', '(1*(1/1))', '((1/1)^1)'}
2 {'(1*(1+1))', '((1^1)+1)', '((1+1)/1)', '((1*1)+1)', '((1+1)^1)', '(1+(1*1))', '((1/1)+1)', '(1+(1^1))', '(1+(1/1))', '((1+1)*1)'}
3 {'((1+1)+1)', '(1+(1+1))'}
4
5
6
7
8
9
10 {'(11-1)'}
>>> m(3,3)
1 {'((3/3)^3)'}
2 {'(3-(3/3))', '((3+3)/3)'}
3 {'(3-(3-3))', '((3-3)+3)', '((3/3)*3)', '(3*(3/3))', '(3/(3/3))', '((3+3)-3)', '(3^(3/3))', '(3+(3-3))', '((3*3)/3)'}
4 {'((3/3)+3)', '(3+(3/3))'}
5
6 {'((3*3)-3)'}
7
8
9 {'(3+(3+3))', '((3+3)+3)', '((3^3)/3)'}
10

Python (imperfect) 493 474 - 300 = 174
There are a fair number of issues with this solution, firstly  that it ignores any exponent that is too large (any in which the exponent is greater than 100). I actually don't think this removes any possibilities for inputs less than or equal to 5, but I'm not 100% sure.
Another thing is that it does not consider any unary square roots, as it would get complicated (any solution with any term equal to 0 or 1 would produce an infinite number of solutions). It also does not consider any unary negation (the '-' symbol) for the same reason, as well as the fact that I'm not actually sure if the question asked for it.
I also considered what criteria should decide if two expressions were equivalent, but I couldn't find a way to rigorously define it in a way I found to be intuitive, so (for now at least) I didn't implement anything like that. This does mean that it outputs quite a few results, and it also uses parenthesis in a fairly naive way.
On a side note I think that this might include the longest single line of code I've written, especially before it was fully golfed.
R=range
F=lambda s:lambda a,b:eval(s)
L=lambda D,N:[(int(str(D)*N),str(D)*N)]+[(o(u,v),"(%s%s%s)"%(s,c,t))for p in R(1,N)for u,s in L(D,p)for v,t in L(D,N-p)for c,o in[('+',F('a+b')),('-',F('a-b')),('*',F('a*b')),('/',F("1.*a/b if b else''")),('^',F("''if(a<0 and int(b)!=b)|(a and b<0)|(b>99)else a**b")),('v',F("b**(1./a)if a and(a>=0 or b)and(b>=0 or int(1./a)==1./a)&(1./a<99)else''"))]if o(u,v)!='']
A=L(*input())
for i in R(11):
 for v,s in A:
    if v==i:print i,s[1:-1]

Example: ('v' represents '√')
2,3

0 2*(2-2)
0 2v(2-2)
0 (2-2)*2
0 (2-2)/2
0 (2-2)^2
1 2^(2-2)
1 2-(2/2)
1 2v(2/2)
1 (2/2)^2
2 2v(2+2)
2 2+(2-2)
2 2-(2-2)
2 2v(2*2)
2 2*(2/2)
2 2/(2/2)
2 2^(2/2)
2 2v(2^2)
2 (2+2)-2
2 (2+2)/2
2 (2-2)+2
2 (2*2)-2
2 (2*2)/2
2 (2/2)*2
2 (2/2)v2
2 (2^2)-2
2 (2^2)/2
3 2+(2/2)
3 (2/2)+2
6 2+(2+2)
6 2+(2*2)
6 2+(2^2)
6 (2+2)+2
6 (2*2)+2
6 (2^2)+2
8 2*(2+2)
8 2*(2*2)
8 2*(2^2)
8 (2+2)*2
8 (2*2)*2
8 (2^2)*2

I found a couple things you can do to shorten L: L=lambda D,N:[(int(str(D)*N),str(D)*N)]+[(o(u,v),"(%s%s%s)"%(s,c,t))for p in R(1,N)for u,s in L(D,p)for v,t in L(D,N-p)for c,o in[('+',F('a+b')),('-',F('a-b')),('*',F('a*b')),('/',F("1.*a/b if b else''")),('^',F("''if(a<0 and int(b)!=b)|(a and b<0)or b>100 else a**b")),('v',F("''if a==0 or(b<0 and int(1./a)!=(1./a))or(b or a<0)or(1./a)>100 else b**(1./a)"))]if o(u,v)!='']

I'm sorry, that comment looks really bad :( Anyway, to explain: when comparing against 0, I tried to negate the statement, then swap the consequences. I also found a few places to use | and & instead of or and and. Both of these tricks could be used to shorten the last call to F, but that one would require some Demorgan's and I ran out of beak time ;p

@FryAmTheEggman Oh that's a good catch, I've updated my answer with what you posted and when I have time I'll look at the last one. Those conditionals to check the validity of the input did get a bit more hefty than I expected :/

+10 for the brilliancy of nested lambdas and eval--it took me quite a while to figure your second line out! I think I've got you beat on "longest single line," though. ;) I agree on ignoring large exponents; in fact, I think any exponent bigger than 9 isn't going to be useful (except as a no-op when the base is 1).

@DLosc Well the one scenario you can have is something like 3 = 33 √ (3 ^ 33). Actually as I write this I realize that two (probably the only two?) combinations that my answer misses are 4 = (4^4)  √ (4 ^ (4^4)) and the equivalent expression with 5s. Admittedly roots don't seem to add much to the problem, as the vast majority of them are either used as no-ops on either 0 or 1, no-ops when the root is 1, or just to cancel out a power.

As I read the OP's description, expressions like (4^4) √ (4 ^ (4^4)) aren't valid: "You can also use a 3 before √ to denote a cube root," which to me means that there can only be a bare number before √, not an expression. (I also infer that 1√ and 2√ aren't valid either.) I'm not sure about 33 √ (3 ^ 33), though. I stayed away from nth roots as well as square roots. :P

Python 3 – 349 346
r=range
l=lambda s:eval("lambda a"+s)
def T(u,f,X,Y):
    try:return u(f(X,Y))
    except:0
c=l(',x:{x}.union(*[{u(int("1"*a)*x)}|{T(u,f,X,Y)for j in r(1,a)for X in c(j,x)for Y in c(a-j,x)for f in[l(",b:a%sb"%o)for o in{"**"}|set("+-*/")]+[l(",b:a**b**-1")]}for u in[l(":-a")]+[l(":a**.5**%i"%k)for k in r(9)]])')
R=l(",i:[{n+1}<c(i,a)for n in r(10)]")

Here is a rather ungolfed version:
def R(x,i):
    # Unary Operations
    U = [lambda a:-a] + [eval("lambda a:a**(1/2.**%i)" % j) for j in range(9)]
    # Binary Operations
    F = [eval("lambda a,b:a%sb"%o) for o in ["+","-","*","/","**"]] + [lambda a,b:a**(1./b)]

    def combos(i):
        L = {x}
        for u in U:
            # 3, 33, 333, etc.
            L |= {u(int(str(x)*i))}

            for j in range(1,i):
                for X in combos(j):
                    for Y in combos(i-j):
                        for f in F:
                            # To avoid trouble with division by zero, overflows and similar:
                            try:
                                L |= {u(f(X,Y))}
                            except:
                                pass
        return L

    return [n in combos(i) for n in range(1,11)]

For testing I recommend to change (9) to something smaller, since this is the number of multiple square roots taken into account, which has a huge impact on the performance.
Finally, this made me wonder, whether the unary minus is actually needed in some case …

I think you are right about the unary '-' probably not adding anything (at least to the base question without the bonuses). The only non-trivial scenario I can think of would be anything like 1 = 3^3 * 3^(-3), but even considering these, I doubt there are any numbers for which this is a possible solution when there are no others.

You can save 3 bytes by using a**.5**%i instead of a**(1/2**%i) to compute the multiple square roots.

@DLosc: Indeed, thanks.

You can save six bytes by reducing the four space indent to one space.

@BetaDecay: I never use four-space indents (shudder), I use tabs. Just look into the source of my post. Stack Exchange just renders them as four spaces.

Ahh, I see. I didn't know a tab was a single character

@Optimizer: To clarify: This answer does not hang, it just takes a very long time. However, this is code golf and you made no constraints regarding the runtime. Moreover, I have a strong feeling that this is inherent to the challenge, if you actually want to solve it. Sure, there a lot of things to optimise about my solution when it comes to runtime, but they won’t change the complexity class.

Mathematica - 246 characters (no bonuses claimed)
f[x_,y_]:=x-y
g[x_,y_]:=x/y
h[x_,y_]:=x^(1/y)
j[x_,y_]:=FromDigits@Join[IntegerDigits@x,{y}]
z[{r_,n_,L_}]:=z[{L[[1]][r,n],n,Rest@L}]
z[{r_,n_,{}}]:=r
a[n_,t_]:=Union@Select[z[{n,n,#}]&/@Tuples[{Plus,f,Times,g,Power,h,j},t-1],IntegerQ@#&&0<#<11&]

Explanation
Function j concatenates two numbers digit-wise.
Function z takes a result r, number n, and list of functions L, each which operates on two arguments.  It then applies the list of functions sequentially to argumnts [r,n] using recursion, until the list is empty, whereupon it returns the result.
Function a takes a number n and a number of copies t.  It creates all tuples of length (t-1) from the list of functions {Plus, f, Times, g, Power, h, j} and sends each tuple through function z, then returns a list of all numbers 1 through 10 that were created.
Example execution a[2,3] returning {1, 2, 3, 6, 8}.
Limitations
Because the list of functions is applied sequentially, consuming one copy of the number each time, it can miss some combinations.  For example, when operating on four twos, it would miss 22/22 = 1 due to its inability to evaluate the list of functions out of order.  Of course, 2/2*2/2 = 1 covers this case.


text:
Increment every number in a string
Given a string containing decimal numbers:
teststring134this 123test string54 100
increment every number in this string by one to give the new string
teststring135this 124test string55 101.
The string can be provided as:

a command line argument
STDIN
a hard-coded variable or function argument

Cover all possible positions for a number:

as a prefix for a word; 123test ► 124test
as a suffix for a word; test123 ► test124
inside a word; te123st ► te124st
alone test 123 test ► test 124 test

Here's a non-golfed solution in Python:
NUMBERS = '0123456789'

def increment(s):
    out = ''

    number = ''
    for c in s:
        if c in NUMBERS:
            number += c
        else:
            if number != '':
                out += str(int(number) + 1)
                number = ''
            out += c

    if number != '':
        out += str(int(number) + 1)
        number = ''

    return out

print "\"%s\"" % (increment('teststring134this 123test string54 100'))

This is a code-golf question, shortest code wins.

Fun fact: this can be done with 3 pure regex substitutions (no callbacks) http://stackoverflow.com/questions/12941362/is-it-possible-to-increment-numbers-using-regex-substitution/12942634#12942634 (that wouldn't be the golfiest way though)

You specified input but not output. From your input spec I assume both STDOUT and and return value are fine. But can we also store the result in a hardcoded variable (just as we can take input from it)?

Your code shouldn't work... Don't you need to declare NUMBERS as a global variable inside increment(s) or is it different in Python 2?

What about carrying? What happens to 999?

possible duplicate of Multiply all numbers in a string

Shucks, when I saw the title I thought this was about implementing inflationary language.

What about negative numbers? What about numbers with a decimal point? What about numbers with a decimal point and nothing before it (except perhaps for a minus sign)?

@BetaDecay It works fine in Python 2 and 3, you can read variables from outer scopes.

What about numbers with leading zeros? "A0000" -> "A1"? "A0001"?

@BetaDecay You need to put an explicit declaration if you want to assign to outer scopes.

Perl, 14 bytes
s/\d+/$&+1/ge

Requires the -p switch, which I have counted as one byte.
Example run
$ perl -p <(echo 's/\d+/$&+1/ge') <<< 'teststring134this 123test string54 100'
teststring135this 124test string55 101

Very similar to my answer here haha http://codegolf.stackexchange.com/a/37113/29438

Ruby, 30 24 bytes
$><<s.gsub(/\d+/,&:next)

Expects the input to be stored in s.

Couldn't $1.next be used in the block?

@August nice, thanks! I didn't know next was that sophisticated.

JavaScript (ES6) - 28
H=k=>k.replace(/\d+/g,k=>++k)

Run by using H("test 123 234t").

You can take out the H= and just have it be an anonymous function.

Vim - 13 keystrokes
0qqqqq^Al@qq@q

Expects the input to be the current line.
Or for finitely many numbers (e.g. 999) in 8 + ceil(log(n)) keystrokes:
0qq^Alq999@q

I can't seem to make this work....  (I am using vim 7.0.237)

Python 2 - 59
Supply the string as the variable n
import re;print re.sub('\d+',lambda x:`int(x.group())+1`,n)

Perl, 23
Assumes the input string is assigned to $_
s/\d+/@{[$&+1]}/g;print

C99 - 86 (GCC 4.9.0 and Visual C++ 2013)
Edit: Both GCC 4.9.0 (with -std=c99) and Visual C++ 2013 successfully build (with warnings) the same code without the includes.  I didn't know you could do that!  Thanks for the hint.
Edit: It didn't even occur to me that I should write it to the screen on the fly instead of creating the string and then printing it.  That makes a huge difference.  Thanks Dennis!
This is using a hard coded string but the contents of the string are not counted towards the total (the ="" is counted).
main(i){for(char*q,*s="test123test999test-1test";i=strtol(s,&q,0),*s;q>s?printf("%d",i+1,s=q):putchar(*s++));}

Basically it runs through the string one character at a time checking each to see if it is an integer.  If it is then it increments the integer and writes it to the output otherwise it copies the current character to the output.
This leaks the hardcoded string because it increments s.

I'm sure you can get rid of some of the includes and it will still compile fine with gcc.

Will this work with a string containing e.g. 99?

@MartinBüttner: Yes but then it wouldn't be valid C, just something that happens to work on gcc.

@R.. That's generally allowed on PPCG though. I've seen (and subsequently done) it quite often without anyone complaining.

Yes, and it's a general peeve of mine. The language should be listed as "GCC" or "C on [particular arch/etc. the hacks happen to work on]" or similar, rather than C, if it's not actually valid C. :-)

@MartinBüttner I'll try!  I was using Visual C++ to compile it.  Maybe GCC is more forgiving.

@R I have labelled it with the compilers I tested it on.  I hope that's ok.

You can change the loop to for(;i=strtol(s,&q,0),*s;(q>s)?printf("%d",i+1,s=q):putchar(*s++));. This make p and o obsolete. 2. You can declare i as main(i).

I only make this 87 characters without the initialisation of s already. There are also a couple of other savings to be had.  You can use char*s without the space and you do not need the brackets round (q>s).  You can also move the declaration and initialisation of s and q inside the for loop to save a semi-colon.

@Alchymist thanks for the tips

Produces incorrect output when a number is preceded by a space ( ).

J (20)
Expects the input to be stored in the variable a.
'\d+'>:&.".rxapply a

Test:
   a=:'teststring134this 123test string54 100'
   '\d+'>:&.".rxapply a
teststring135this 124test string55 101

(f?)lex (39)
File inc.l:
%%
[0-9]+ printf("%d",atoi(yytext)+1);

Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl

Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101

$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)

I did not test this with the original lex. Comments are welcome.

You can drop the trailing %% since this is no user code: http://flex.sourceforge.net/manual/User-Code-Section.html#User-Code-Section

Hey... yes! I tried but without trailing newline and that failed... then I didn't try to add the final newline... ;-) ...stupid mistake!

Emacs - 20 characters
C-M-% [0-9]+ RET \,(1+ \#0) RET !

Requires text to be processed to be present in the current buffer.  I counted C-M-% as one character here since it can be entered with one keystroke when holding down three modifiers.

Racket 74
(define(f x)(regexp-replace* #px"\\d+"x(λ(m)(~a(+ 1(string->number m))))))

GNU sed, 304 (including 1 for -r flag)
I close-voted this question as a possible duplicate, but this is perhaps contrary to that because this answer can't be trivially changed to work there.  By far the longest answer though.
Inspired by this example from the sed documentation, though it needed some work to handle multiple numbers in a string:
:d
s/9([^0-9]+|$)/_\1/g
td
s/8(_*)([^0-9]+|$)/9\1\2/g
s/7(_*)([^0-9]+|$)/8\1\2/g
s/6(_*)([^0-9]+|$)/7\1\2/g
s/5(_*)([^0-9]+|$)/6\1\2/g
s/4(_*)([^0-9]+|$)/5\1\2/g
s/3(_*)([^0-9]+|$)/4\1\2/g
s/2(_*)([^0-9]+|$)/3\1\2/g
s/1(_*)([^0-9]+|$)/2\1\2/g
s/0(_*)([^0-9]+|$)/1\1\2/g
s/(^|[^0-9_]+)(_+)/\11\2/g
y/_/0/

Output:
$ for s in "teststring134this 123test string54 100" "123test" "test123" "te123st" "test 123 test" ; do echo "$s" | sed -rf incr.sed ; done
teststring135this 124test string55 101
124test
test124
te124st
test 124 test
$

Note this temporarily inserts _ characters, so could lead to incorrect results if there are _ in the input stream.  As a mitigation to this, we can replace the _ in the sed script with some non-printable character (e.g. ASCII 0x07 BEL), and assume the input stream contains only printable ASCII.  This seems to work fine when I test it.

Lua - 68 characters
d='(%D-)'for k,i,j in s:gmatch(d..'(%d+)'..d)do io.write(k,i+1,j)end

Expects the input to be stored in s.

CJam, 67 58 53 48 31 characters
This question is like the worst question for CJam. No regex, no pattern matching, no exception catching. But here we go (#YOLO)
Sl+_A,sNerN%\[_A,s-Ner~]:)]zs1>

This one splits the string in group of just alphabets and just digits. The increments each digit and stitches back the two array taking one element of each at a time.

Previous solution:
L_l{:Ci57-zA<:RC*+:N\R!N*NNW?i):NL?+RLC?@R*}/NL?

Try it online here
How it works:
Basic idea is to keep storing the character separately in a string if it is a digit and dump the incremented value to the final string once we get a non digit character.
L_                                               "Push two empty strings to stack,"
                                                 "first representing the final string"
                                                 "and second, the current ongoing number";
  l{                                       }/    "Run this block for each character of input string";
    :Ci                                          "Store the character to C and convert to"
                                                 "its ASCII equivalent integer";
       57-zA<:R                                  "Subtract 57 from the integer and compare"
                                                 "its absolute value with 10. Numeric character"
                                                 "would result to true here. Store the result in R";
               C*+:N                             "Take either 0 or 1 characters from C based"
                                                 "on value of R, add it to the second string"
                                                 "from first step. Also store the value in N";
                    \                            "Switch the strings. Now the string containing"
                                                 "the final result string is at top of stack";
                     R!N*                        "If the character was not a digit and N contains a number in it";
                         NNW?i):NL?+             "Convert N to number and increment it."
                                                 "If N is blank, take 0 instead. Put the final"
                                                 "value back in N and add it to the final result string";
                                    RLC?         "If the character was not a digit, push it to stack";
                                        @R*      "Put the ongoing numeric string back to top of stack";
                                             NL? "This is to handle the case when the last number"
                                                 "is not followed by a string, so stack will"
                                                 "have a string at top. Push the value of N to stack in that case";

Cobra - 88
do(s='')=RegularExpressions.Regex.replace(s,'\d+',do(m as Match)='[int.parse("[m]")+1]')

C# - 178 169 157 characters
This assumes that numbers like 999 are allowed to overflow to 000 and that -+,.E are not part of a number.
class T{static void Main(){var a="".ToCharArray();for(int b=1,c,i=a.Length;i-->0;b=48>c|c>57?7:b>0?c>56?a[i]='0':++a[i]*0:b)c=a[i];System.Console.Write(a);}}

Better readable form:
class T
{
    static void Main()
    {
        var a="7teststring134this 123test string59 100".ToCharArray();

        for (int b=3, c, i=a.Length; i-->0;
            b=48>c|c>57
                ?7
                :b>2
                    ?c>56?a[i]='0':++a[i]*0
                    :b
        ) c=a[i];

        System.Console.Write(a);
        System.Console.ReadKey();
    }
}

I'm new here, never tried code golf before, just gave it a try :)
I wonder if anyone has ideas to get it even shorter...
To participate with C# it would be nice if we could omit all the necessary framework around the actual code - then this would only have 82 chars, and that without calling any powerful system functions.

The same with pointers (182 chars):
class T
{
    unsafe static void Main()
    {
        char[] a="7teststring134this 123test string59 100".ToCharArray();

        int b=3;
        fixed (char* s=&a[0])
            for (var p=s+a.Length; p-->s; )
                b=*p<48|*p>57
                    ?7
                    :b>2
                        ?*p>56?*p='0':++*p*0
                        :b;

        System.Console.Write(a);
        System.Console.ReadKey();
    }
}

Now without overflowing, this correctly handles the 999 case (223 chars):
class T
{
    static void Main()
    {
        var s=new System.Text.StringBuilder("9999teststring134this 123test string99 100");

        for (int b=3, c, i=s.Length; i-->0; )
        {
            c=s[i];
            b=48>c|c>57
                ?b>8?8:7
                :b>2
                    ?c>56?c-(s[i]='0'):++s[i]*0
                    :b;
            if (b>8&i<1|b==8) s.Insert(i+9-b, '1');
        }

        System.Console.Write(s);
        System.Console.ReadKey();
    }
}

Another different older one, it reads from standard input and uses recursion:
namespace System {
    using C=Console;
    class T {
        class t {
            byte b=1;
            string s="";
            void R() {
                var c=C.Read();
                if (c>31) {
                    R();
                    if (48>c|c>57) b=1;
                    else if (b==1) c=c==57?48:++c*b--;
                    s=(char)c+s;
                }
            }
            public t() {
                R();
                C.Write(s);
            }
        }
        static void Main() {
            new t();
            C.ReadKey();
        }
    }
}

Note: Console.ReadKey(); and the string itself should not be counted.
I improved this already multiple times, see comments. There is still room for more improvements, I would say :)
And sorry for the length, but I think the different versions are interesting enough to keep them...

no, getting rid of the "environment" isn't allowed. i reckon in your second code after if(c==57) you could write c--; instead of c=48;, what about the ternary operator too. there is infact a lot of golfing tricks. maybe you should visit http://codegolf.stackexchange.com/questions/2203/tips-for-golfing-in-c

Thanks, I know nothing about golf :) everything you see here was invented by me ;-) 57-1 isn't 48. So I don't understand.

Oops :-) :-) :-) :-)

I don't really know C# well, but I guess you can use some operator to stick them together like ... ? ... : c++*b--

btw sorry for sending you the C tips instead of the C# tips: http://codegolf.stackexchange.com/questions/173/tips-for-code-golfing-in-c

Let us continue this discussion in chat.

Thanks a lot for the hints. I improved it a lot now. Any more ideas? ... It's not nice to downvote my solution without a comment. Please tell me why you don't like it ...

it's not me, I didn't downvote your answer

@proud Sorry, I put two independent messages in one. Of course I didn't mean you.

Groovy, 38 bytes
{it.replaceAll(/\d+/,{(it as int)+1})}

Uggghhh... I absolutely hate the words replace and all, they ruin all regex golfs for me.

(it as int)+1 → it.next()

AWK, 40 bytes
BEGIN{RS="[0-9]+";ORS=e}$0=$0(RT?RT+1:e)

Try it online!
Parses each substring of numbers as a record separator (default is a newline, "\n"). Adds one to the record text (RT), that is the number that previously matched to the regex. Except for the last RT, which is null. That's what the last condition is about. Otherwise, there would be a 1 appended to the end of the output.

Vyxal s, 8 bytes
⁽±Ḋƛ±[⌊›

Try it Online!
Who needs regex amiright?
Explained
⁽±Ḋƛ±[⌊›
⁽±Ḋ      # Group the input by whether each item is numeric
   ƛ     # To each group:
    ±[   #   If it's numeric:
      ⌊› #     Cast to int and increment
# -s flag sums into a single string.

How does it work though?

Perl 6, 13 bytes
{S:g{\d+}+=1}

Try it online!
Very simple regex substitution that just increments each instance of a series of digits

Brachylog, 17 bytes
~c{ịᵐc+₁ṫ|ịˢĖ&}ᵐc

Try it online!
Explanation
~c{ịᵐc+₁ṫ|ịˢĖ&}ᵐc
~c                 Partition the input string such that
  {           }ᵐ   this predicate can be applied to each substring:
                    Either:
   ịᵐ                Convert each character to a number (i.e. they are all digits)
     c               Concatenate the digits into a single number
      +₁             Add 1
        ṫ            Convert back to a string
         |          Or:
          ịˢ         Find all characters that can be converted to a number
            Ė        Assert that that list is empty (i.e. none of them are digits)
             &       Return the substring unchanged
                c  Concatenate the results back into a single string

PHP - 91 Bytes
<?$i=fgets(STDIN);for($n=0;$n<strlen($i);$n++)if(is_numeric($i[$n]))$i[$n]=$i[$n]+1;echo$i;

I don't wanted to use regular expressions. PHP isn't capable to directly increment a string offset, so, I needed to add some bytes on the increment step. This one line script remembers me a very dark age of the PHP scripting...

I have observed just now that the question asks you to increment the result number of a sequence of algarisms. This answer is incorrect. But I really feel that the op should add more details about what he wants.

K, 56
{" "/:{,/$(`$a)^`$$1+"I"$a:_[;x]@&~~':x in .Q.n}'" "\:x}

sed and bash - 40 (including invocation and pipes)
$ cat << EOF |sed 's/[0-9]\+/$((\0+1))/g;s/^/echo /'|bash
teststring134this 123test string54 100
123test
test123
te123st
test 123 test
EOF

Outputs:
teststring135this 124test string55 101
124test
test124
te124st
test 124 test

I tried this test string: 42;rm -rf / It worked the first time.

You can change \0 to & (-1 char), $((…)) to $[…] (-2 chars), s/^/echo / to iecho \\ (-2 chars) to shorten your current code. However better fix the bug mentioned by @Dennis first. (He wrote “It worked the first time” for fun and as hint about the issue. Actually your code fails on input containing ;, #, \…`, $(…)` and maybe other special characters too.)

Arbitrary code execution is a feature :-)

There may be no way to go this route without some kind of input restrictions and keeping the code tiny.  The nature of the solution is to translate the input and use an interpreter to do the math since sed can't do it.  As soon as user input hits an interpreter, the escaping is nuts.  Short of the previous sed example, sed can't do math.

Somewhat shorter: eval echo \sed 's/[0-9]+/$[&+1]/g'`` - still has the code injection problem though, as per my answer to another similar question http://codegolf.stackexchange.com/a/37145/11259

Scoring appears to be a bit off - sed 's/[0-9]\+/$((\0+1))/g;s/^/echo /'|bash is 43 bytes by my count

Java 7, 119 bytes
void c(String s){for(String x:s.split("(?=[^\\d]+)|(?<=[^\\d]+)"))System.out.print(x.matches("\\d+")?new Long(x)+1:x);}

If the requirement is a program instead of just a function, then it's 149 bytes:
class M{public static void main(String[]a){for(String x:a[0].split("(?=[^\\d]+)|(?<=[^\\d]+)"))System.out.print(x.matches("\\d+")?new Long(x)+1:x);}}

Ungolfed & test code:
Try it here.
class M{
  static void c(String s){
    for(String x : s.split("(?=[^\\d]+)|(?<=[^\\d]+)")){
      System.out.print(x.matches("\\d+")
                        ? new Long(x) + 1
                        : x);
    }
  }

  public static void main(String[] a){
    c("123test");
    System.out.println();
    c("test123");
    System.out.println();
    c("te123st");
    System.out.println();
    c("test 123 test");
    System.out.println();
    c("7teststring134this 123test string59 100");
  }
}

Output:
124test
test124
te124st
test 124 test
8teststring135this 124test string60 101

DASH, 16 bytes
rstr[R"\d+""g"+1

This returns a function/partial application.
Usage:
rstr[R"\d+""g"+1]"test 123 234t"

Explanation
rstr[          #. replace any parts of the input
  R "\d+" "g"  #. matching /\d+/g
  +1           #. with its incremented form
]

Gema, 14 characters
<D>=@add{$1;1}

Sample run:
bash-4.3$ gema '<D>=@add{$1;1}' <<< 'teststring134this 123test string54 100'
teststring135this 124test string55 101

CJam, 18 bytes
q_A,s-_:(:`ers~]:)

Try it here.
Explanation
q         e# Read input.
_A,s-     e# Duplicate and remove digits.
_         e# Duplicate.
:(:`      e# Decrement and get the string representation of each character.
er        e# Map the characters to the decremented string representation.
s~        e# Flatten to string and evaluate.
]:)       e# Wrap in an array and increment each element.

R, 83 bytes
Late to the party. Assumes input is stored in variable x. It's probably not needed to use regmatches to solve this but I couldn't figure out vectorized replacements without any external packages.
paste0(el(r(x,m<-gregexpr("\\d+",x),T)),c(as.numeric(el(r(x,m)))+1,""),collapse="")

Ungolfed and explained
r=regmatches                                        # Alias for regmatch
y=r(x<-scan(,""),m<-gregexpr("\\d+",x))             # return match digits
i=r(x,m,T)                                          # return inverted match (non-digits)
paste0(el(i),c(as.numeric(el(y))+1,""),collapse="") # join digits+1 and non-digits, element-wise

Example output
input:
"teststring135this 124test string55 101"

output:
[1] "teststring136this 125test string56 102"

C# (Visual C# Interactive Compiler) with command-line option /u:System.Text.RegularExpressions.Regex;System.Int32, 40 bytes
Replace(n,"\\d+",m=>Parse(m.Value)+1+"")

Expects input to be in a variable named n.
Try it online!

Invalid, cannot expect input in a variable

@ascii-only This question seems to explicitly allow it' though personally, I would try to stick to today's input standards

Oh wait :/ ew this question

Stax, 9 bytes
ü╜≥NÇNX╪ÿ

Run and debug it
regex

Pip, 8 bytes
aR+XD_+1

Try It Online!
Explanation

Who needs regex amiright?
  - Lyxal

Pip, that's who. Pip needs regex.
aR+XD_+1
a         Command-line input
 R        Replace
   XD       Regex matching a digit
  +         one or more times
          with
     _      The match
      +1    plus 1

(U_ also works for the callback function, but then there would have to be a space after XD, so it's the same bytecount.)

Haskell, 81 bytes
(""!)
n!(c:t)|'/'<c&&c<':'=(n++[c])!t|n==""=c:n!t
""!s=s
n!s=show(1+read n)++""!s

Try it online!
Explanation
Define the ! operator to take two arguments. The first, n, is a string where we track the current run of digits. The second, s, is the remainder of the input string. The actual submission function is ! with "" bound as its first argument:
(""!)

The rest of the program defines !.
n!(c:t)

If the string is not empty, separate it into its first character c and tail t, and try to match one of the following cases:
|'/'<c&&c<':'

If c is a digit character...
=(n++[c])!t

... then append it to n and recurse with that new value of n and t.
|n==""

Otherwise, if n is empty (and c is a non-digit character)...
=c:n!t

... then prepend c to the result of a recursive call with the same (empty) n and t.
So far, we've covered the following cases:

Nonempty s, first character is a digit
Nonempty s, first character is not a digit, empty n

We still need to cover the following cases:

Nonempty s, first character is not a digit, nonempty n
Empty s, empty n
Empty s, nonempty n

Noting that the middle one of the three is the only remaining case where n is empty, we address that one next:
""!s=s

If both n and s are empty, return s (empty string).
Finally, we combine the last two cases as "n is nonempty and s does not start with a digit":
n!s=show(1+read n)++""!s

Read n as an integer, add 1, convert back to a string, and concatenate to a recursive call with empty n and the same s.

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