There exists a brain game called Enumerate (which I made, based on Takuzu). Your challenge is to play this game.
Task
Solve a game of 4x4 Enumerate/Takuzu.
- Receive a starting grid via STDIN or command line.
- Output the solved grid via STDOUT or writing to file.
Rules
A game is characterized by a 4x4 board, made up of red and purple cells.
There must be the same number of red and purple cells in each row and column (2 red and 2 purple in each).
There must be no identical rows or columns.
Input
The starting grid will be given as a 16 character/byte string consisting of only 0
, 1
, and 2
. Here is an example:
0001100002001200
1
represents a red cell and 2
represents a purple cell. All input boards will be solvable.
Note: If your language does not support string literal input, you may take input as an array of integers. Please state in your answer that this is the case. So there is no confusion, this is what said array should look like:
[0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 0]
No nested arrays are allowed.
Output
The solved board should be output in the same format as above; a 16 character/byte string, consisting of only 1
and 2
. Here is the solution for the input above:
2121112222111212
Again, 1
represents a red cell and 2
represents a purple cell.
Bonuses
A -25 byte bonus is offered for any answer that outputs the solved board as an ASCII grid. Here is an example of the previously mentioned board.
2|1|2|1
-+-+-+-
1|1|2|2
-+-+-+-
2|2|1|1
-+-+-+-
1|2|1|2
A -50 bytes bonus is offered for any answer that outputs the solved board in color. This can be output as an image or colored text.
If colored text is chosen, the output should look like this:
2121
1122
2211
1212
However, if an image is the chosen output method, the resulting file should be 20x20 pixels, where each cell is a colored 5x5 pixel block. Here is an example:
Here are the color codes:
Red - #a73cba OR (167, 60, 186)
Purple - #f94a32 OR (249, 74, 50)
Samples
In: 0020010100000100
Out: 1221212112122112
In: 0010000200121000
Out: 2211112221121221
In: 1000100102000000
Out: 1122122122112112
0
,1
, and2
? What about a two-dimensional array? \$\endgroup\$