how do i compare two approaches in masyu puzzle
How Do I Compare Two Approaches in Masyu Puzzle

What "comparing two approaches" means in a Masyu loop

Masyu asks you to trace one closed orthogonal loop through every black and white pearl while satisfying two opposite local rules, and comparing two approaches means choosing between solving pearl-by-pearl (working from each clue outward) and solving shape-first (drawing the loop outline and only checking pearls second). On a fixed four-by-four board, both strategies can lead to the same twelve-step solution that earns 880 points, but the order of decisions, the kinds of errors you catch early, and the speed of rediscovery differ in measurable ways. The Masyu Puzzle browser tool exposes that comparison directly: the board is disclosed, the validation is live, and a Restart command lets you replay either route from a known empty state. To compare the two approaches meaningfully, you need one reproducible puzzle, two clearly defined decision orders, and a way to score each attempt — which is exactly what the tool provides.

The two standard approaches at a glance

Before you start pressing keys, it helps to write down what each approach actually decides first. Pearl-by-pearl means the next cell is chosen because it satisfies one pearl's local rule. Shape-first means the next cell is chosen because it preserves a planned outline of the loop, and pearl rules are checked afterwards. The table below captures the practical difference between the two on the disclosed fixture.

Aspect Pearl-by-Pearl Shape-First (Perimeter)
First decision Identify the black pearl's required 90-degree turn Pick a closed outline that touches all four edges
Order of work Local clue, then one cell Whole perimeter, then clue check
Where errors appear A single pearl rule violation at any step An outline that misses a pearl or crosses itself
Restart cost Low — usually only the last 2–3 cells need redrawing Medium — the outline may need to be reshaped
Score on this fixture 880 points at twelve accepted steps 880 points at twelve accepted steps

The score formula is identical for both routes: score = max(0, 1000 − 10 × accepted steps). With twelve accepted steps, the arithmetic is 1000 − 10 × 12 = 1000 − 120 = 880. The route may differ in feel, but the math at the end is the same.

Set up the same fixed board for both attempts

The fixture is a disclosed four-by-four grid with a black pearl in the upper-left corner and a white pearl immediately to its right. Open the Masyu Puzzle page and leave the cursor on that starting black pearl. The board is an accessible CSS grid, so each cell announces its row, column, and pearl type, and the active cursor has a visible outline. Pressing Space or Enter on the black pearl starts the loop, and from that moment every accepted arrow key extends the route by exactly one orthogonal cell. Restart restores the original cursor, empty path, and starting score of 1,000, so both approaches are evaluated from the same initial state. There is no audio, no random service, and no downloaded art — only keyboard input against a fixed fixture, which is what makes the comparison fair.

How to run the perimeter-first approach on the 4x4 fixture

The perimeter-first approach treats the loop as a closed rectangle and lets the pearl rules be checked against that outline. Run these steps in order; the Restart button at any point returns you to a clean board so you can retry.

  1. Press Space or Enter on the black pearl in the upper-left corner to start the route.
  2. Use the right arrow to extend into the white pearl cell on the top row — straight through is mandatory here.
  3. Press right twice more to continue across the top row to the top-right corner.
  4. Press down three times to travel down the right edge.
  5. Press left three times to travel across the bottom row.
  6. Press up three times to travel up the left edge, closing the loop on the starting black pearl.
  7. If all pearl rules hold, the route is accepted and the score reads 880.

Because the white pearl sits directly to the right of the black pearl, the turn at the upper-left corner supplies the "neighboring turn" the white pearl requires, and the black pearl's two adjacent arms (rightward and upward) are both straight. The browser validates each accepted move; an out-of-bounds press does nothing, and pressing into a cell already on the route produces a detected dead end because a simple loop cannot reuse a body cell.

How to run the pearl-by-pearl approach on the 4x4 fixture

The pearl-by-pearl approach works the loop out from each clue, accepting each cell only when it satisfies the pearl currently under consideration. The same fixture, the same Restart, the same twelve-step finish — only the decision order changes.

  1. Press Space or Enter on the black pearl to begin, then use the right arrow once to reach the white pearl; the black pearl already records a 90-degree turn with one arm going right.
  2. Continue right past the white pearl because the white pearl forces straight passage — no turn allowed on the pearl itself.
  3. Stop at the top-right corner cell. The white pearl's required neighboring turn is not at this corner; it is supplied by the turn on the black pearl at (0,0), which is one cell from the white pearl.
  4. Press down three times along the right edge; these cells are plain body cells, so straight passage is the only constraint.
  5. Press left three times across the bottom row to land on the bottom-left corner.
  6. Press up three times to travel up the left edge, closing the loop on the black pearl; the black pearl's two arms are its immediately neighboring cells (0,1) and (1,0), and the line passes straight through both.
  7. If the arms are straight and the white pearl had its neighboring turn earlier, the route is accepted at 880.

This route produces the same twelve accepted moves but in a different decision order: each accepted cell first checks a pearl rule, while the perimeter-first route first checks an outline. If a step fails, Restart returns the board to the empty state, and the score drops back to 1,000 — useful for re-running the pearl-by-pearl attempt with a different neighboring turn position.

Comparing the two approaches on the same fixed board

Once both attempts have been played through, the comparison falls out of the keyboard history, the step count, and the score panel. The table below summarizes the qualitative differences you will observe on the disclosed fixture.

Observed behavior Pearl-by-Pearl Shape-First (Perimeter)
First accepted step Right arrow into the white pearl cell Right arrow into the white pearl cell
First place a rule matters Before each accepted move At the closing step
Failure signal "Invalid route" at the closing step if a pearl rule is missed "Invalid route" if the outline misses a pearl or reuses a cell
Earliest restarts needed Rare — local mistakes are visible mid-route Rare — outline mistakes show at the corner turns
Final score (12 accepted steps) 880 880

The exact score arithmetic is the same in both rows: 1000 − 10 × 12 = 880. The interesting comparison is where the two approaches put your attention. Pearl-by-pearl forces you to ask "does this move satisfy the pearl I am on or near?" at every step. Shape-first defers that question until the outline is closed and then checks all pearls together. If you want to study the failure mode of one approach in isolation, run a third attempt where you deliberately violate the white-pearl straight-passage rule and observe how each approach catches it — both attempts flag the violation only when the loop closes, because pearl-rule validation happens at closure.

When each approach is the right choice

Use the perimeter-first approach when the board is small, the pearl density is low, and a closed outline obviously touches every pearl. That is exactly the situation on the disclosed four-by-four fixture, where the twelve-step perimeter is hard to misroute. Use the pearl-by-pearl approach when you suspect that no single outline will satisfy every clue, or when you want a faster mental loop: each move has to clear one local rule before you take it, and the browser validation gives you an immediate yes-or-no on every press. On larger or denser boards, the pearl-by-pearl approach scales better because local reasoning is independent of overall outline shape. On this four-by-four fixture the two approaches are equivalent in score and step count, which is the cleanest possible comparison: same puzzle, same result, two different routes through the same set of decisions. For related deduction games that reward similar local-versus-global thinking, the common-mistakes guide for Masyu walks through the rule traps each approach can fall into, and the broader puzzle category on the site includes Shingoki, Heyawake, Hitori, and Pipes for further practice on the same keyboard-first style. According to the published rules at Nikoli, these local-versus-global patterns are exactly the kind of "looking ahead" that defines good Masyu solving, and the disclosed 4x4 fixture is a controlled environment in which to compare them.

For a deeper look, see Compare Two Approaches in Maze Game: Discovery vs Memory.