Show HN: Creating a Binary Puzzle Game
What is a binary puzzle? There's a grid (n × n boar, commonly 6 × 6 or 8 × 8). Two symbols – traditionally 0/1, black/white, or, in LinkedIn’s case, moons and suns.
Rules Equal count – each row and each column contains the same number of each symbol (e.g. three 0s and three 1s in a 6 × 6 grid). No three in a row – you can’t have three identical symbols consecutively in any row or column These three simple constraints make the puzzle non‑trivial but always deterministic: a correctly generated board has a unique solution.
Some history: Early 2000s it appeared in Japanese puzzle magazines as Binairo. Later popularised in the West as Takuzu (“binary” in Japanese). LinkedIn rebranded the same mechanics as Tango, swapping 0/1 for moons and suns. The underlying logic is identical it's just the graphics that are a cosmetic layer.
How I generate an endless supply The hardest part is guaranteeing that every new board is both valid and uniquely solvable. My generator follows a standard constructive approach:
Back‑tracking placement – recursively fill cells, pruning any branch that would break a rule. Early symmetry breaking – enforce row/column uniqueness as soon as possible to cut the search space. Uniqueness verification – once a full grid is built, run a deterministic solver; if more than one solution exists, backtrack and try a different seed.
Live demo – https://taengo.vercel.app Source code – https://github.com/alexander-gekov/taengo (need to clean it up in the next days).
No comments yet