A 4x4 Challenge

CJam (score 13)

With coloured text bonus, only printable characters: 64 chars - 50 = 14

l:~:L,Eb2*e!4m*_:z&{_M*L1$.e|.=1-!*_&,4=},~{27c'[@_4*27+'m@}f%N*

This can be improved by one char using a non-printable character: 27c'[@ becomes "^["\ where ^ represents character 27, giving a score of 13. xxd version:

0000000: 6c3a 7e3a 4c2c 4562 322a 6521 346d 2a5f  l:~:L,Eb2*e!4m*_
0000010: 3a7a 267b 5f4d 2a4c 3124 2e65 7c2e 3d31  :z&{_M*L1$.e|.=1
0000020: 2d21 2a5f 262c 343d 7d2c 7e7b 221b 5b22  -!*_&,4=},~{".["
0000030: 5c5f 342a 3237 2b27 6d40 7d66 254e 2a    \_4*27+'m@}f%N* 

Straight solution with no bonus: 42 chars

l:~:L,Eb2*e!4m*_:z&{_M*L1$.e|.=1-!*_&,4=},

Online demo


With grid bonus: 59 chars - 25 = 34

l:~:L,Eb2*e!4m*_:z&{_M*L1$.e|.=1-!*_&,4=},~'|f*2N*'-4*'+***

Online demo


With image output, 83 chars - 50 = 33. Output is in netpbm format.

'P3NKSKS255Nl:~:L,Eb2*e!4m*_:z&{_M*L1$.e|.=1-!*_&,4=},~4f*M*:("§<ºùJ2":i3/f=4f*M*S*

Online demo


CJam, 74-50=24 bytes (color output)

l:~:L;5ZbGm*{_L.-L.*:|!\[4/_z]_:::+e_6-!\__.&=**},s4/{"["\_~4*27+'m@}f%N*

I don't think this is very well-golfed, but it works! Try it here. Warning: slow.

l:~:L; reads a line of input into L. Then, 5Zb is [1 2], and we take the 16th Cartesian power (Gm*) of this list, to get all possible solutions [[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] ...]. The filter { }, contains the Takuzu logic.

I added a ANSI code color output bonus:

color output

This doesn't work on the website, of course. There is an unprintable ESC byte in the string "[".