Previous | Contents | Index | Next

Chapter 36: Pearl

You have a grid of squares. Your job is to draw lines between the centres of horizontally or vertically adjacent squares, so that the lines form a single closed loop. In the resulting grid, some of the squares that the loop passes through will contain corners, and some will be straight horizontal or vertical lines. (And some squares can be completely empty – the loop doesn't have to pass through every square.)

Some of the squares contain black and white circles, which are clues that the loop must satisfy.

A black circle in a square indicates that that square is a corner, but neither of the squares adjacent to it in the loop is also a corner.

A white circle indicates that the square is a straight edge, but at least one of the squares adjacent to it in the loop is a corner.

(In both cases, the clue only constrains the two squares adjacent in the loop, that is, the squares that the loop passes into after leaving the clue square. The squares that are only adjacent in the grid are not constrained.)

Credit for this puzzle goes to Nikoli, who call it ‘Masyu’. [19]

Thanks to James Harvey for assistance with the implementation.


36.1 Pearl controls

Click with the left button on a grid edge to draw a segment of the loop through that edge, or to remove a segment once it is drawn.

Drag with the left button through a series of squares to draw more than one segment of the loop in one go. Alternatively, drag over an existing part of the loop to undraw it, or to undraw part of it and then go in a different direction.

Click with the right button on a grid edge to mark it with a cross, indicating that you are sure the loop does not go through that edge. (For instance, if you have decided which of the squares adjacent to a white clue has to be a corner, but don't yet know which way the corner turns, you might mark the one way it can't go with a cross.)

Alternatively, use the cursor keys to move the cursor. Use the Enter key to begin and end keyboard ‘drag’ operations. Use the Space, Escape or Backspace keys to cancel the drag. Or, hold Control while dragging with the cursor keys to toggle segments as you move between squares.

Pressing Control-Shift-arrowkey or Shift-arrowkey simulates a left or right click, respectively, on the edge in the direction of the key.

(All the actions described in section 2.1 are also available.)

36.2 Pearl parameters

These parameters are available from the ‘Custom...’ option on the ‘Type’ menu.

Width, Height
Size of grid in squares.
Controls the difficulty of the generated puzzle.
Allow unsoluble
If this is set, then the game will be generated in the simplest way: every clue square that can possibly be provided will be shown, and the generator will not check whether the puzzle can be uniquely solved.

This speeds up game generation, and allows much larger grids to be played. At least one possible solution will still always exist, but there's no guarantee that it will be unique, or that it will be possible to deduce it step by step.

36.3 Pearl user preferences

On platforms that support user preferences, the ‘Preferences’ option on the ‘Game’ menu will let you configure the style of the game display. ‘Traditional’ is the default mode, in which the loop runs between centres of grid squares, and each clue occupies a square. ‘Loopy-style’ is an alternative mode that looks more like Loopy (chapter 23), in which the loop runs between grid vertices, and the clues also occupy vertices.

[Simon Tatham's Portable Puzzle Collection, version 20240330.fd304c5]