Heyawake is a Japanese room-shading logic puzzle invented by Hiroyuki Fukushima and first published in Nikoli issue 39 in September 1992, in which players shade cells inside outlined rooms so that every numbered room contains exactly its indicated count of black cells, no two black cells share an edge, all unshaded cells stay orthogonally connected, and no straight horizontal or vertical run of white cells passes through more than two rooms. These four constraints together define the official Heyawake rules as published by Nikoli, and they apply on grids of any size from beginner fixtures to competition layouts. The name へやわけ (Heyawake) combines heya (room) and wake (reasoning or separation), reflecting how solvers must reason across room boundaries rather than inside a single region. A beginner-friendly way to internalize every rule is to play a fixed, fully disclosed fixture such as the Heyawake Puzzle, where the three-by-six board contains three outlined vertical rooms, each carrying the clue 1, and the entire solution is provable in three shade actions.

The Four Core Constraints of Heyawake Rules
Every Heyawake puzzle, regardless of size, is governed by the same four constraints. The first is the room count: the small number printed inside each outlined region tells you exactly how many black cells that room must contain. The second is the adjacency rule: two black cells may never share a horizontal or vertical edge, although diagonal contact is allowed. The third is the white connectivity rule: every unshaded cell must be reachable from every other unshaded cell through a chain of orthogonal white neighbours, so the white region forms one connected area. The fourth is the corridor rule: a continuous straight horizontal or vertical run of white cells may not cross through more than two rooms; once a white corridor enters a third room, the position is invalid.
These constraints interlock. A puzzle that satisfies only the room counts is not yet solved, because two counts can hide adjacent blacks or a broken white region. The Nikoli rule definition treats adjacency and connectivity as hard contradictions, while the corridor rule limits how white space can stretch across the board. Solvers learn to check all four together rather than one at a time, and a well-designed fixture such as the Heyawake Puzzle exposes every constraint in a small, reproducible layout.
Room Numbers, Black Cells, and White Cells
The board is a rectangular grid divided into irregular outlined regions called rooms. Each room carries a clue number that specifies how many of its cells must be black at the end of the solution. In the Heyawake Puzzle the grid is three rows tall and six columns wide, partitioned into three vertical rooms of six cells each, and every room shows the clue 1. That means exactly one cell in the top room, one cell in the middle room, and one cell in the bottom room must be shaded, for a total of three black cells across eighteen cells.
The cells you do not shade become white. White cells are not passive background; they carry real obligations. They cannot be split into two disconnected islands, and they cannot let a straight row or column of white cells travel through all three rooms in an unbroken line. The visual distinction matters because many solvers misread Heyawake as a pure counting puzzle. Counting is the first filter, but the connectivity and corridor rules determine which of the count-satisfying arrangements is actually a legal solution.
The Three-Room Corridor Rule Explained
The corridor rule is the constraint most often missed by new solvers. Imagine every row of the grid: if you look at one row and read left to right, you can group the white cells into consecutive runs. Each run lives inside some sequence of rooms. As soon as a single run touches three different rooms, the board is invalid, even if every room has the correct count and the white area is still connected elsewhere.
The Heyawake Puzzle makes this rule visible from the start. On the empty board, the three rows are wide white corridors, and each row already crosses all three rooms. The first shade you place in a row breaks that row into shorter segments, and the goal is to arrange all three shades so that no horizontal or vertical white run ever reaches the third room without a black cell stopping it first. The corridor rule therefore forces you to spread your black cells across different rows and columns rather than clustering them in one corner of the board.
How to Play the Heyawake Puzzle
- Move the selection across the eighteen-cell grid with the arrow keys. The current cell is highlighted so you always know where the next action will land.
- Press Space to shade the current cell black. Press Space again on a black cell to unshade it; each actual shade or unshade counts as one move for scoring.
- Press Enter to place an optional white-cell mark on the current cell. Marks are personal reasoning notes that have no effect on validation, and Enter again removes the mark.
- Place exactly one black cell in each of the three rooms. On this fixture every room shows the clue 1, so each room needs exactly one shaded cell and no more.
- Keep black cells apart. If you ever shade two cells that share an edge, validation reports an immediate contradiction and the position cannot become a solved board without removing one of them.
- Keep the white area connected. After each shade, the remaining white cells must form a single orthogonal region. Any island of white cut off from the rest is a contradiction.
- Break every straight white run that crosses three rooms. After your shades land, scan each row and column; if a run of white cells passes through three rooms, place another shade or remove one to repair it.
- Stop once all three rooms show their clue, no black cells touch, the white cells are connected, and no run spans more than two rooms. Three clean shade actions on cells 1, 9, and 16 complete the disclosed fixture for a score of 970.
Scoring, Validation, and Contradictions
The Heyawake Puzzle starts every run at 1,000 points. Each time you press Space in a way that actually changes the board, the score drops by 10. Three correct shades on the disclosed fixture therefore land at 1,000 minus 3 times 10, which equals 970. The score is floored at 0, so extremely wasteful runs cannot go negative. Validation recalculates after every shade rather than only on completion, so you see the rule status update in real time as you work.
Validation distinguishes between two kinds of error. Adjacent black cells and overfilled rooms are contradictions that must be repaired before the board can be solved, while an underfilled room or an overlong white corridor is a constraint that prevents completion but can still be fixed with another legal shade. A contradictory position simply cannot become a finished solution; a constrained position can still progress. Automated tests confirm all three room clues, exact partition size, adjacency rejection, white connectivity, the two-room corridor limit, the empty board's visible three-room corridor, exact clue matching, and the full three-shade sequence, plus a separate simulation that shades two neighbours and confirms deadlock detection.
| Rule | Hard contradiction | Repairable constraint |
|---|---|---|
| Room clue match | Room contains more blacks than its clue | Room contains fewer blacks than its clue |
| Black adjacency | Two black cells share an edge | Not applicable |
| White connectivity | White cells split into two disconnected regions | Not applicable |
| Corridor limit | Not applicable | A straight white run spans three rooms |
Controls, Marks, and Reset Options
The Heyawake Puzzle supports three input paths. Keyboard users move with the arrow keys, toggle black with Space, and add or remove an optional white mark with Enter. Mouse and touch users click a cell to toggle its black state and use the context menu gesture for a white mark. The board is rendered with an accessible CSS grid that uses site variables for every surface, border, foreground, focus outline, and warning, so contrast and focus rings remain consistent across devices without requiring a canvas, audio, timer, pointer precision, account, or network call.
Restart clears every black cell, every white mark, the move counter, the score, and any reported contradiction, returning the board to the empty fixture. Double-press Escape opens a shared spreadsheet cover that hides the puzzle as a quick boss-key gesture; pressing Escape twice more resumes the run. A completed best score may be saved in localStorage so the same browser can track your fastest clean finish between sessions.
Where Heyawake Fits Among Shading Logic Puzzles
Heyawake belongs to a family of binary determination puzzles where each cell ends up either shaded or unshaded and a small set of global constraints decides which arrangement is legal. The closest cousin is Hitori, where you shade repeated numbers so that no shaded cells touch and the remaining unshaded cells stay connected. The reasoning pattern is identical, even though Hitori shades duplicates rather than counting toward a clue. Readers who enjoy that style of layered constraint can compare the two walkthroughs side by side in the Hitori rules guide, which covers the same connectivity and adjacency logic in a five-by-five format.
The Nikoli Heyawake page is the primary source for the official rule definition and confirms that adjacency forbids shared edges while allowing diagonal contact, that room clues are exact, and that corridor crossings are limited to two rooms. Puzzle Heyawake independently cross-checks those same four constraints on its own board, and the source for the published room-count convention is described in the Puzzle Heyawake FAQ. Together these references explain why a fixed, small fixture is enough to learn the rules that scale to competition grids, and they confirm that the implementation choices in the Heyawake Puzzle, such as the disclosed solution, the score formula, and the boss key, are deliberate rather than accidental.
Related reading: Hard Hidato Puzzles: Solve a Verified 4x4 Number Path.