# 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.

[19] `http://www.nikoli.co.jp/en/puzzles/masyu.html` (beware of Flash)

## 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.

[Simon Tatham's Portable Puzzle Collection, version 20170427.2d33375]