Battleships решение
Battleship is a find-the-fleet puzzle based on a grid representing an ocean section with a fleet of ships hidden inside. The goal is to reveal the fleet by logically deducing the location of ship segment. The numbers on the right and on the bottom of the grid indicate how many squares in the corresponding row and column are occupied by ship segments. Ships may be oriented horizontally or vertically without touching each other, not even diagonally, and sometimes a few squares may be revealed with hints to start you off. The most popular Battleship grid size is 10x10 with a fleet of one battleship, two cruisers, three destroyers and four submarines as shown below.
Basic techniques
1. Fill what you know around given ship segments:
Let’s start with the puzzle below which contains three given ship segments and two given water segments. Since submarines consist of one segment, all neighboring squares of H8 must be filled with water by marking them with an X. Square C4 contains the end segment of a ship, which means there is another part of the ship in C5. Since the count of row C is two, this ship must be a destroyer. We can now place the other end segment and fill the ten squares surrounding the destroyer with water by marking them with an X. Square F10 is a middle segment of a ship so it must be part of a battleship or a cruiser and must be oriented vertically because it is touching the frame of the gird. Therefore the squares above and below are ship segments (denoted by dots) and three more squares are filled with water.
2. Remaining empty squares in a row or column are water:
This technique helps complete rows and columns where ship segment counts are fully accounted for. Row A and columns 2 and 7 have counts of 0 meaning they contain no ship segments so all squares are marked with X to indicate water. Row C has a count of 2 which is accounted for in C4 and C5 so the remaining squares are marked with X. And finally, row F and columns 4 and 5 all have a count of 1 which is accounted for so the remaining squares are also marked with X.
3. Remaining empty squares in a row or column are ship segments:
This technique helps find rows and columns whose remaining empty squares contain ship segments. Let’s look at column 3 which has a count of 4. Since there are exactly four empty squares, all of them must contain a ship segment. This means a submarine must be placed in E3 and a cruiser in H3, I3, and J3. We can now go back and use basic technique 2 in row E to mark the remaining squares with X.
Advanced techniques
1. Remaining ships of one type can be placed in one way only:
This technique is used when there’s only one way to place all remaining ships of a particular type. In this puzzle we need to place three destroyers. There are seven valid positions to place a single destroyer: D3-E3, D10-E10, E9-E10, G3-H3, G10-H10, J2-J3, and J9-J10. Although this may seem daunting, some possible destroyer positions will exclude others. For example, D10-E10 and E9-E10 are mutually exclusive. An examination will show there is only one way to place all three destroyers at the same time: E9-E10, G10-H10 and J2-J3. Placing a submarine in D3 will now solve the puzzle completely.
2. Overlapping squares when placing a ship:
This technique is used when there are overlapping squares when placing a ship. In the example below, the 4-segment battleship can only fit in row C. However, although there are three valid positions to place a battleship in this row, squares C3 and C4 will always contain a ship segment. Since we don’t yet know which segments of the battleship these squares are going to be, we will mark them temporarily with dots.
3. Indirect logic (process of elimination):
Indirect logic can be used in many forms to prove a square must have specific content such as a ship or a water segment. In this example we want to show square H10 must be a ship segment and not water. Let’s assume H10 is water by temporarily marking it with X. According to basic strategy 3, the rest of row H has to contain two additional cruisers which brings the total number of found cruisers to three. Since there can only be two cruisers in a fleet the conclusion is clear: square H10 cannot be water and must be a ship segment.
Good candidates for indirect logic are rows and columns that have exactly one remaining water segment to place such as in row H of the example we just examined.