How to use the nurikabe solver
This nurikabe solver works on any rectangular grid up to 15 by 15 in the editor (20 by 20 when pasted as text). Choose the size, type each number into its cell, leave every other cell empty and press Solve. Black cells are filled in, white cells get a small dot, and the solver tells you whether the answer is the only one. You can also paste a grid as text, one row per line.
The rules
- Each number is part of a white island with exactly that many cells. Every island contains exactly one number.
- Islands never touch each other side by side (touching at a corner is fine).
- All black cells form one connected wall, joined side by side.
- The wall never contains a 2 by 2 square of black cells.
Before solving, the solver checks for mistakes it can name: two numbers next to each other (their islands would merge), numbers that add up to more cells than the grid has, or numbers that cover the whole grid and leave no wall.
Is the answer unique?
A published nurikabe has exactly one solution, and the solver checks that. It keeps searching after the first answer; if it finds a second one, both are shown and the cells where they differ are outlined. If none exists it says so, which usually points to a number in the wrong cell. Every answer is checked against the four rules before it is shown.
How the solver works
For every number the solver first lists all the shapes its island could take: sets of connected cells of the right size that contain the number and do not touch any other number. It then places one island at a time, always the number with the fewest shapes left, and after each placement:
- the cells around the finished island become black, because no other island may touch it;
- any cell that no remaining island can reach becomes black;
- the branch is dropped as soon as the black cells form a 2 by 2 square, or a black cell is cut off from the rest of the wall.
Because each later step only keeps the shapes that still fit, the lists shrink quickly. Puzzles with very large islands in wide open grids can have hundreds of thousands of possible shapes; the solver says so instead of freezing the page, and you can stop a search at any time. Our test suite compares the solver with a brute force that tries every black and white coloring of small grids, and checks bigger grids built from random valid walls.
Tips for solving by hand
Start with the 1s: the cells around a 1 are black. A cell between two numbers that could reach it from both sides must be black, since the islands may not touch. Any cell that no number can reach is black. Then look for the 2 by 2 rule: three black cells around a corner force the fourth cell white, and some island must be able to reach it.
If you like island puzzles, hashi joins numbered islands with bridges, and slitherlink draws a single loop around numbered cells.
Want to play one? Nurikabe online has new grids at three sizes and a daily puzzle.
Solver tested . Found a problem? Tell us.
Questions
What are the rules of nurikabe?
Each number is in a white island of that many cells, islands do not touch side by side, all black cells are connected into one wall, and the wall has no 2 by 2 black square.
Can two islands touch diagonally?
Yes. Islands may not share a side, but touching at a corner is allowed.
Why does the solver say there are too many shapes?
Large numbers in an open grid can form a huge number of island shapes. The solver lists them all before searching, and stops before that would take too long in a browser. Check that every number is right; real puzzles rarely need that many.
Why does the solver say there is no solution?
No placement of islands keeps the wall connected without a 2 by 2 black square, or an island has no room to grow. Usually a number was typed in the wrong cell or with the wrong value.
Is nurikabe the same as islands in the stream?
Yes, it is also published as islands in the stream or cell structure. The rules are the same.