Based on a /r/dailyprogrammer puzzle: Takuzu solver.
Basically, Takuzu is a logic puzzle similar to Sudoku. You are given a grid partially filled with 0s and 1s. You have to fill in the rest of the grid according to three simple rules:
- You cannot have more than three of the same number in a line
- Each column must have an equal number of 0s and 1s1
- No two rows or no two columns can be identical
Thus, if you have a puzzle like this:
0.01.1 0....1 ..00.. ..00.. 1....0 10.0.0
One valid solution (most puzzles should have only a single valid answer, but that doesn’t always seem to be the case):
010101 001101 110010 010011 101100 101010
Let’s do it!