Binary is the new Sudoku

A couple of days ago somebody sent me an e-mail asking if I could write a program that generates binary puzzles. I didn't know what binary puzzles were, but a search in google quickly led me to this site. Apparently, the "Binary" is a new kind of logic puzzle that involves only the numbers zero and one. The goal is to fill in the grid with zeros and ones with the following restrictions:

• There are as many zeros as ones in every row and every column.
• No more than two of the same numbers can be next to or under each other.
• Rows or columns with the same content are not allowed.
Every puzzle has a unique solution, which in this case is: The program I wrote uses the following algorithm to generate new puzzles. First it fills a grid with random zeros and ones in such a way that all restrictions apply. Then it removes numbers randomly while making sure that the puzzle maintains exactly one solution. When it has removed the right amount of numbers the puzzle is shown on screen. Click here to download the jar (source files are included) and read on for instructions on how to use the program. (more…)