4. In a "Battleship" game on a grid with $7 \times 7$ cells, what is the minimum number of shots needed to guarantee hitting a four-deck ship? It is known that the ship (1) has shape $A$ (Figure 2); (2) consists of four adjacent cells, but is not a square.
Solution: (1) Since 12 ships of shape $A$ can be placed in a $7 \times 7$ grid such that no two ships share a common cell, the number of shots required is at least 12. From figures $3, a, b$, it is shown that 12 shots are sufficient.
(2) 20 steps.

As shown in Figure 4, 20 shots can complete the task. Suppose we shoot 19 times, dividing the $7 \times 7$ grid into four non-overlapping $3 \times 4$ rectangles (as in Figure 4), one of which has no more than 4 shots. Assume this rectangle is as shown in Figure 5. Clearly, there should be a shot in one of its columns, and no row contains 3 shots (otherwise, a ship of shape $A$, $B$, or $D$ could be placed in this rectangle without being hit). Considering the central cell $a$ in the rectangle in Figure 5, there can be only one shot configuration in the $3 \times 3$ square (or a symmetric configuration) (Figure 6). However, in that shot configuration, a ship of shape $C$ (Figure 2) can be placed in the $3 \times 3$ square. Therefore, it can be assumed that shots occur in cells $a$ and $b$. In this case, cells 1, 3, 4, 5, 6, and 7 (Figure 5) are not shot. One of the four corner cells must also be unshot. For example, cell 2. However, then a ship can be placed in cells 1, 2, 3, and 4. Therefore, in any configuration of 19 shots, a ship can be placed in the remaining cells of the $7 \times 7$ grid without being hit.