Crate takuzu[][src]

A library for solving Takuzu (a.k.a. Binairo) number puzzles.


Takuzu is a number puzzle, sometimes called binary sudoku. The objective is to fill a grid with 0s and 1s while observing the following rules:

  • no more than two zeros or two ones adjacent to each other in any direction.
  • each row and each column must contain an equal number of 0s and 1s.
  • no two rows and no two columns are the same.

The grids are squares of even size. A valid grid must have one and only one solution. The solver will find and return all valid solutions though.

Input format

For parsing, the grids must be represented with the following characters: 0, 1, . for a missing number, and one \n at the end of each row. The final \n may be omitted.

Example grids



Displays a colored diff in ANSI terminals.


An opaque container for manipulating takuzu grids.



An enum representing the state of a cell.


An error returned when checking if the grid is legal.


An error returned when parsing a string to create a grid failed.


An error returned when the grid is not properly sized.