Saturday, May 28, 2011

Tapestry Puzzle for Android

(It is all in the numbers. Try to uncover the mystery behind the clues that will lead you to the hidden Tapestry.) 

Tapestry puzzle, also known as Pic-a-Pix or Gobelini, is a picture logic game where we with logical deduction and combination try to figure out which cells in a grid have to be colored or left blank according to numbers given at the side of the grid to reveal a hidden picture. In this puzzle type, the numbers measure how many unbroken lines of filled-in squares there are in any given row or column. For example, a clue of "4 8 3" would mean there are sets of four, eight, and three filled squares, in that order, with at least one blank square between successive groups.

There are 3 types of fields:
  1. box - tap once
  2. space - tap twice
  3. untouched - leave or tap three times
In order to solve a puzzle, one needs to determine which cells are going to be boxes and which are going to be empty. Determining which cells are to be empty (called spaces) is as important as determining which are to be filled (called boxes). Later in the solving process, the spaces help to determine where a clue (continuing block of boxes and a number in the legend) may spread.

It is also important never to guess. Only cells that can be determined by logic should be filled. If guessing, a single error can spread over the entire field and completely ruin the solution. It usually comes to the surface only after a while, when it is very difficult to correct the puzzle. Usually, only advanced and experienced solvers are able to fix it completely and finish such ruined puzzles.
The hidden picture plays no part in the solving process. Even if it is obvious from the picture that a cell will be a box, it is usually treacherous to rely on it. The picture, however, may help find and eliminate an error.

Simpler puzzles can usually be solved by a reasoning on a single row only (or a single column) at each given time, to determine as many boxes and spaces on that row as possible. Then trying another row (or column), until there are rows that contain undetermined cells.

Some more difficult puzzles may also require several types of 'what if?' reasoning that include more than one row (or column). This works on searching for contradictions: When a cell cannot be a box, because some other cell would produce an error, it will definitely be a space. And vice versa. Advanced solvers are sometimes able to search even deeper than into the first 'what if?' reasoning. It takes, however, a lot of time to get some progress.


Hint 1 - Simple boxes 1

At the beginning of the solution a simple method can be used to determine as many boxes as possible. This method uses conjunctions of possible places for each block of boxes. For example, in a row of ten cells with only one clue of 8, the bound block consisting of 8 boxes could spread from:
  • the right border, leaving two spaces to the left;
  • the left border, leaving two spaces to the right;
  • or somewhere in between.
In result, the block will spread for sure through the conjunction in the middle.

Hint 2 - Simple boxes 2

The same as in hint 1 of course applies when there are more clues in the row. For example, in a row of ten cells with clues of 4 and 3, the bound blocks of boxes could be:
  • crowded to the left, one next to the other, leaving two spaces to the right;
  • crowded to the right, one just next to the other, leaving two spaces to the left;
  • or somewhere between.

Consequently, the first block of three boxes definitely includes the third cell, while the second block of four boxes definitely includes the seventh and eighth cells. Boxes can therefore be placed in the third, seventh and eighth cells.

Important note: When determining boxes in this way, boxes can be placed in cells only when the same block overlaps; in this example, although two blocks overlap in the sixth cell, they are different blocks, and so it cannot yet be said whether or not the sixth cell will contain a box.

Hint 3 - Simple spaces

This method consists of determining spaces by searching for cells that are out of range of any possible blocks of boxes. For example, considering a row of ten cells with boxes in the fourth, eight and ninth cell and with clues of 3 and 2, the block bound to the clue 3 will spread through the fourth cell and clue 2 will be at the eight and ninth cells.

First, the clue 2 is complete and there will be a space at each side of the bound block.

Second, the clue 3 can only spread somewhere between the second cell and the sixth cell, because it always has to include the fourth cell; however, this may leave cells that may not be boxes in any case, i.e. the first and the seventh.

Note: In this example all blocks are accounted for; this is not always the case. The player must be careful for there may be clues or blocks that are not bound to each other yet.

Hint 4 - Forcing

In this method, the significance of the spaces will be shown. A space placed somewhere in the middle of an uncompleted row may force a large block to one side or the other. Also, a gap that is too small for any possible block may be filled with spaces.

For example, considering a row of ten cells with spaces in the fifth and seventh cells and with clues of 3 and 2:
  • the clue of 3 would be forced to the left, because it could not fit anywhere else;
  • the empty gap on the sixth cell is too small to accommodate clues like 2 or 3 and may be filled with spaces;
  • finally, the clue of 2 will spread through the ninth cell according to method Simple Boxes above;

Hint 5 - Glue

Sometimes, there is a box near the border that is not farther from the border than the length of the first clue. In this case, the first clue will spread through that box and will be forced outward from the border.

For example, considering a row of ten cells with a box in the third cell and with a clue of 5, the clue of 5 will spread through the third cell and will continue to the fifth cell because of the border.

Note: This method may also work in the middle of a row, further away from the borders:
  •  A space may act as a border, if the first clue is forced to the right of that space;
  • The first clue may also be preceded by some other clues, if all the clues are already bound to the left of the forcing space;

Hint 6 - Joining and Splitting

Boxes closer to each other may be sometimes joined together into one block or split by a space into several blocks. When there are two blocks with an empty cell between, this cell:
  • will be a space, if joining the two blocks by a box would produce a too large block;
  • and will be a box, if splitting the two blocks by a space would produce a too small block that does not have enough free cells around to spread through;
For example, considering a row of ten cells with boxes in the second, fourth, seventh and ninth cell and with clues of 2, 1 and 3:
  • the clues of 2 and 1 will split the first two blocks by a space, because a box would produce a block of 3 continuous boxes, which is not allowed here;
  • the clue of 3 will join the last two blocks by a box into one large block, because a space would produce a block of only 2 boxes at the end and that is not enough there;

Hint 7 - Punctuation

To solve the puzzle, it is usually also very important to enclose each bound and/or completed block of boxes immediately by separating spaces as described in Simple spaces method. Precise punctuating usually leads to more Forcing and may be vital for finishing the puzzle. 

Hint 8 - Mercury

Mercury is a special case of Simple spaces technique. Its name comes from the way mercury pulls back from the sides of a container.

If there is a box in a row that is in the same distance from the border as the length of the first clue, the first cell will be a space. This is because the first clue would not fit to the left of the box. It will have to spread through that box, leaving the first cell behind. Furthermore, when the box is actually a block of more boxes to the right, there will be more spaces at the beginning of the row, determined by using this method several times.