Binary puzzle solver

download solver program.
download puzzle examples.

Introduction

Below is pictured a binary puzzle in the unsolved state.



This puzzle consists of n*n squares (n=6,8,10,12,14) in which the binary digits 0 and 1
have to be placed such that:
    - each column or row holds the same amount (n/2) "0"s and "1"s
    - no more the 2 adjacent "0"s or "1"s may occur in a column or row.
    - no columns may be equal.
    - no rows may be equal.
Some digits are already filled in. These digits are colored brown and cannot be changed.
The player has to fill in the remaining empty cells using logical reasoning.
These digits are painted in black.

If the player is stuck, hints may be generated.
These digits are colored grey.



Puzzle after some hints.
The last added hint cells have a yellow background color.
The last modified cell has a red circle painted.



Solved puzzle with only hints.

Program control

Main menu buttons


    - open: open puzzle from disk
    - save: save puzzle on disk
    - help: open HTML help page
    - new: allow painting a new puzzle.
    - play: allow searching for solution.

Control buttons


    - game size selection: click on dimension (in new mode).
    - clear button: erase all digits (in new mode).
    - hint (lamp) button: search for hints (play mode).
    - back button: remove last player entry or last hint(s) (in play mode).
    - org button: remove all player entered digits and hints (in play mode).

Open and save

Files of binary puzzles do not have an extension.
Instead a puzzle name is automatically prefixed by BIN_

Entering a new puzzle

Press new.
Select game dimension by mouseclick on game size box.
clear button erases old game.
Click on an empty cell to enter a "0".
Click on a "0" cell to enter a "1".
A next click on a "1" cell removes the digit.
If the fixed (brown) digits are all entered, press play.

Solving a puzzle

For entering (black) digits in cells, see before (entering a new game).
The last cell entered shows a red circle.
When pressing back this digit is removed and the circle is placed on the previous cell.

Hints
When stuck, a click on the hint button let the program search for hints.
(also, the hint search is started by pressing the SPACE bar) The hint supplied digits are colored gray.
It is not possible to change hint digits by mouseclicks.
Instead take back moves by pressing the back button or the backspace key.

Backtracking
In case of very hard puzzles (example veryhard2 a hint search may fail.
in this case enter a "0" in an empty cell and proceed as before.
If an error occurs, press the back button until the guessed number is reached.
Now change the "0" into a "1". Etcetera.

Game cases
Imagine an 8*8 puzzle.

A row or column of
   ...00... becomes ..1001..
...1.1.. becomes ...101..
101...1. becomes 101...10
Two Rows or two columns of
   01101100         01100110
   0.10110. becomes 00101101
Because two equal rows or two equal columns are not allowed.

Note on hints

At the start of a puzzle a list of all valid "words" is generated.
word means a full column or full row.
In case of a 6*6 puzzle:
001011,001101,010011,010101...etc. are valid words.

Hints are generated by comparing all valid words with a column or a row.
Hints are open cells that only allow a "0" or a "1".
These hints may be very hard to find.

Solvability

Puzzles may
    1. be unsolvable
    2. have one unique solution
    3. have multiple solutions
Case 1.
Errors occur when using hints.
Such a puzzle is wrong.

Case 2.
Puzzle is solvable by hints or a combination of hints and backtracking.

Case 3.
No hints are found.
Backtracking shows that the contents of some cells are irrelevant.