nurikabe / docs / Nurikabe_Strategies.txt

# vim:ft=txt

#. Proximity analysis - some cells can be eliminated because they are not
reachable (also consider that white cells of certain islands interfere
with the extent of different islands).

#. A straight row or column of black cells can be tested for black cells in
its middle which will place two white cells and so one can conclude that
they are white.

#. If you have something like:

   |[B][G][B]
   |[G][G][B]
   -----------------

Then it is evident that the upper [G] (Gray/Unknown) has to be white, or else
the lower [G]s will also all be black.

#. Cells between two islands (either diagonally or in a one-cell vertical
or horiozntal spacing) must be black, or else the two islands will be joined.

#. Filling-style strategy: if past a certain geometery (that is within the
limits of its number), an island can only expand into one cell, then that
cell will be white.

#. If an Island reaches certain points which consume all of its
number, then its white edge points can be marked with black in the opposite
direction to its extent.

#. One cannot have a loop or a path of white cells (including diagonal ones)
from one edge of the board to the other, which contains black cells inside,
because this will prevent the black cells from being contiguous.
    - Alternative phrasing: a polymino of black cells that can only expand into
    a single grey cell will expand there.

#. Sometimes extending an $N -1 island to a white cell in proximity to one of
its cells will cause the remaining cells to form a 4*4 black region. As
a result, this white cell must be black.

#. Often when there's a situation like:

[W][G][G]
[B][B][B]

We can see that the island should expand into the leftmost gray/unknown cell
or else it will need to take a costly detour which will consume the rest of its
number.

#. Islands that can expand in several different manners must mark all the
common black cells inflected by these ways in this way. For example:

+------
|[2][G]
|[G][G]

The lower-right [G] cell must be black because it will be black whether the
2 expands to the right or to the bottom.

In addition, if we have:

    x1 x2 x3 x4
y1     [B][B][B]
y2  [B][4][W][B]
y3  [B][G][W][B]
y4     [G][G][B]

The the 4-cell region can only expand into (x2,y3) or (x3,y4) so
[G](x2,y4) must be black.

#. If marking a cell as white will make it reachable only by one island,
and as a result they will form a parly-diagonal loop of white cells, which
will segment the black master region, then the cell must be black.

#. If we have something like:
   x1  x2 x3
y1 [2W][G][B]
y2 [ G][G][B]

The if [G](x1,y2) is white, then (x2,y1) and (x2,y2) will be black which
will form a 2*2 region of black cells which is impossible.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.