Example 3: In a $5 \times 5$ grid, two players, A and B, play a number swapping game: A starts and the two players take turns filling in the empty cells. A chooses an empty cell and writes the number 1, while B chooses an empty cell and writes the number 0. After filling, the sum of the 9 numbers in each $3 \times 3$ square is calculated, and the largest of these sums is denoted as $A$. A tries to maximize $A$, while B tries to minimize $A$. What is the maximum value of $A$ that A can achieve? (35th IMO Shortlist)
Solution: First, as shown in Figure 5-5, divide the first 4 rows of 20 squares into 10 $1 \times 2$ rectangles. Clearly, each $3 \times 3$ square on the grid contains exactly 3 of the aforementioned 10 rectangles. Therefore, player B can fill one of the two squares in each $1 \times 2$ rectangle with 0 (at least 3 squares will have 0), which ensures that $A \leqslant 6$.

On the other hand, player A can make the value of $A$ no less than 6. A starts by filling the center square with 1, then B fills a square with 0. At this point, either the other 4 squares in the 3rd row are all empty, or the 4th square in the 3rd column is empty, or both groups of 4 squares are empty. Suppose the other 4 squares in the 3rd row are all empty, then A can fill the empty square in the 3rd row and 2nd column with 1. Then B fills another square with 0. At this point, at least one of the 1st and 4th squares in the 3rd row is empty, suppose it is the 1st square, then A can fill this square with 1 for the third time, and B fills another square with 0. As a result, the first 3 consecutive squares in the 3rd row are all 1, and there are 3 0s on the entire grid. Examining the two $3 \times 3$ squares in the upper left corner or the lower left corner, one of them must contain at most 1 0, meaning there are at least 5 empty squares, and A can write 3 more 1s to make the value of $A$ at least 6.
In summary, A can make the maximum value of $A$ be 6.