Shakashaka

Play Shakashaka in your browser, plus the measured reason its region rule is really a test you can run at a single corner of the grid.

Click a white square to drop a triangle in; click again to spin it round the four corners and then back to empty. A number on a black square counts the triangles in the four squares touching it edge-on. When you are done, every connected piece of leftover white has to be a rectangle — square-on or tilted 45°. Check marks the exact corners where that has gone wrong. Everything runs in your browser; nothing is uploaded.

A rule about whole regions that you can check at one point

"Every connected piece of white is a rectangle" sounds like something you can only judge once you can see a whole piece. You can't see one from a single square, so it looks global. It isn't. It is exactly the same as a test you can run at one corner of the grid.

Four squares meet at a corner. Each contributes a 90° wedge, and each wedge is cut in two by the square's own diagonal — eight 45° sectors in a ring. Walk the ring and measure each run of white. A run of two is a right-angled corner; a run of four is a straight edge; all eight means you are deep inside white. Any other run is fatal: an odd one is a 45° or 135° spike, and a run of six is a 270° inside corner, which no rectangle has.

GridBoards the corner rule acceptsOf those, genuinely validDisagreements
3 × 3 3 3 0
4 × 4 23 23 0
5 × 5 89 89 0
6 × 6 1,354 1,354 0
7 × 7 20,039 20,039 0

Checked in both directions across every board up to 7 × 7 — 21,508 of them — and on scattered black-cell layouts besides. Not one disagreement either way. There is a reason rather than a coincidence: outlawing the 270° run outlaws inside corners, a closed boundary with no inside corners has to turn exactly four times, and four right-angled turns is a rectangle. Two rectangles touching at a single point stay two separate regions, because regions here join edge to edge, so they never pinch into one bad shape.

Verified exhaustively to 7 × 7, which is where enumeration stops being cheap — not proved for every size.

"Four corners" is not the test

The obvious way to check a region is a rectangle is to trace its outline and count the turns. Four turns, four corners, rectangle. That is wrong, and it is worth showing how wrong, because it was a real bug in this page's own checker — staircases of half-squares were sailing through as rectangles. What caught it was the corner rule above disagreeing.

GridBoards "four corners" calls validActually rectanglesShare of its yeses that are wrong
1x3 17 1 94.1%
2x2 22 2 90.9%
2x3 143 3 97.9%
3x3 3,013 3 99.9%

A right trapezoid has four corners too, and a staircase of half-squares traces one exactly. On a 3 × 3 the shortcut waves through 3,013 boards when 3 are legal — 99.9% of its yeses are wrong, and it gets worse as the grid grows, not better. The fix is to insist the corners be right angles, which is a dot product of zero, and which also stops a square-on edge from meeting a 45° one.

Which is what makes the puzzle solvable at all

Being local is not a curiosity; it is the reason the solver on this page returns instantly. Each free square has five states, so a search that checks nothing until the end walks 5 + 5² + … + 5ᵏ nodes. Checking corners as it goes cuts that by a factor of at least 23,251:

4 × 4 layoutFree squaresSolutionsWhole search treeNodes actually visited
#1 9 2 2,441,405 105
#2 9 0 2,441,405 50
#3 10 0 12,207,030 25

The right-hand column is measured. The left-hand one is the closed form for the untouched tree, checked against the real unpruned search from zero free squares up to six — past that, running it honestly would mean a billion nodes, which is the point.

The numbers are a garnish

Every puzzle here is built to have exactly one solution, and then every clue it turns out not to need is taken back off. What is left is striking: most black squares end up carrying no number at all. The arrangement of the holes is the puzzle; the digits only tidy up.

GridBlack squaresNumbers actually needed
5 × 5 8.5 1.0
7 × 7 14.3 1.5
9 × 9 21.5 4.8

How to use

  1. Click a white square to place a triangle; click again to rotate it through the four corners.
  2. A number on a black square counts triangles in the four squares touching it edge-on.
  3. Aim to leave every connected patch of white as a rectangle — square-on or tilted 45 degrees.
  4. Press Check to mark the exact grid corners where the rule is broken.
  5. Show solution reveals the one answer the puzzle has.

Frequently asked questions

What are the rules of Shakashaka?

Black squares are fixed. Every white square is either left alone or gets a right triangle filling half of it. When you are done, every connected piece of leftover white must be a rectangle — either square-on or tilted 45 degrees. A number on a black square says exactly how many of the four squares touching it edge-on hold a triangle.

How do you check the rectangle rule without tracing whole regions?

You look at one corner of the grid. Four squares meet there, each contributing a 90-degree wedge that its own diagonal cuts in two — eight 45-degree sectors in a ring. Every unbroken run of white round that ring must be two sectors (a right-angled corner) or four (a straight edge). That local test turns out to be exactly equivalent to the rule about whole regions.

Is that really equivalent, or just usually right?

Equivalent on everything checked: every board up to 7x7, plus scattered black-cell layouts, with no disagreement in either direction. There is a reason too — banning the 270-degree run bans inside corners, and a closed outline with no inside corners has to turn exactly four times, which is a rectangle. It is verified exhaustively to 7x7 rather than proved for all sizes.

Why is counting corners not enough to spot a rectangle?

Because a right trapezoid has four corners too, and a staircase of half-squares traces one exactly. On a 3x3 grid that shortcut waves through 3,013 boards when only 3 are legal. The corners have to be right angles, not merely four in number — that was a genuine bug here, caught by the corner rule disagreeing with the region checker.

Why do so few black squares carry numbers?

Because they do not need to. Each puzzle is built to have exactly one solution and then every clue it turns out not to need is removed. Most black squares end up bare: the arrangement of the holes is doing the work, and the digits only tidy up what is left.

Does this send anything anywhere?

No. Puzzles are generated and solved entirely in your browser and nothing is uploaded.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.