Yin-Yang Font

by Erik Demaine and Martin Demaine, 2021


In a Yin-Yang puzzle, you are given a grid of unit squares, some of which have a black or white circle. Your goal is to fill in every empty square with either a black or white circle so that the black circles are orthogonally connected together, the white circles are orthogonally connected together, and no 2 × 2 square is all black or all white. Like most pencil-and-paper logic puzzles, Yin-Yang is NP-complete, meaning that there is no efficient algorithm to solve them, assuming P ≠ NP.

This typeface features 26 uniquely solvable Yin-Yang puzzles, one for each letter of the alphabet. In the solved font, the black circles form the letter shapes. In the puzzle font, you get a minimal set of clues that uniquely solve to the black circles. You can interactively solve the puzzles by clicking on the blank spaces. Left clicking (or touching) toggles between black, white, and blank. Right clicking acts as an eraser. Middle clicking toggles between black and white, or fills in white. You can drag to paint many circles at once. If you make any local mistakes, they will highlight red: 2 × 2 squares that are all the same color (invalid by the rules) or that alternate black/white/black/white (a derived rule because it makes connectivity impossible — see our paper).

We constructed the puzzles by greedily removing random clues that were found to be redundant (preserved unique solvability) via brute force. We repeated this process several times and then took the “hardest” puzzle, in particular measuring the number of clues and the total number of branches in the uniqueness verification. Some puzzles are harder than others. The hardest is probably V, followed by (in no particular order) A, B, H, I, L, N, P, T, U, W, and X. The easiest puzzles (which should be solvable using just local and boundary rules) are E, J, and M. It's also possible to make a puzzle from an entire word.

The earliest reference we know for this puzzle is the (discontinued) Japanese puzzle magazine Puzzler, which first gave a puzzle in issue #137 from March 1993. There the puzzle was called “白黒をはっきりさせるパズル”, meaning “a puzzle to make white and black clear”. A year later, issue #150 from April 1994 dubbed the puzzle type “しろまるくろまる” (Shiromaru-Kuromaru or 白丸黒丸), meaning “white circle / black circle”, and it became a regular puzzle in the magazine. More recent introductions of this puzzle follow the name Yin-Yang, though we do not know the origins of this name.

Check out other mathematical and puzzle fonts. • Feedback or not working? Email Erik. • Source code on GitHub.