图片
Recently I have been playing a digital cross-puzzle called "Logic Painting". On the surface, it just paints a grid based on rows and rows of numbers, but it actually hides an efficient numerical constraint system. As a hard-core strategy player, I directly disassembled its underlying logic and found that as long as I master a few numerical rules, the speed of solving puzzles can be doubled.
Let's talk about the core numerical structure first: the numbers in each row and column represent the length of the continuous black grid, and the order is from left to right or top to bottom. Assume that the grid width is N and the numbers in a row are [a1, a2, ..., ak], then the total number of cells occupied by these numbers is a1+a2+...+ak, and at least 1 blank space is required between the numbers (k-1 in total), so the total required length = sum + (k-1). If this value is greater than N, it means that the current number combination cannot be established and is eliminated directly. On the contrary, if the sum + (k-1) = N, then there can only be exactly 1 blank between the numbers, and all the grids are forced to be determined, which is the "full filling" state.
The first step of the optimal strategy: scan first those rows or columns whose sum + (k-1) = N, you can directly fill all corresponding grids and set blank intervals. This can quickly create multiple identified cells and provide anchor points for cross-reasoning.
The second step is to use the "overlap method". When the value of a certain number is large, for example, the line length is 10 and the number is [7], then the possible starting positions of 7 consecutive grids are 1 to 4 (because the end cannot exceed 10). Among these 7 grids, positions 4 to 7 (that is, the end of starting position 1 and the beginning of starting position 4 overlap) will be painted no matter what - the calculation method is: starting position range = [1, N - a + 1], overlapping interval = [max(1, starting minimum + a - 1), min(N, starting maximum + a - 1)]. The essence is to draw a range and find the intersection. Drawing this type of grid that must be painted first is equivalent to locking in the key clues.
The third step is numerical subtraction. Once a row or column is partially determined, the number of remaining unsolved cells can be updated and the combination space of the remaining numbers can be recalculated. For example, if a line already has 1 blackened line and the number is [2,1], then the remaining space needs to be reallocated and the remaining blackened positions can be directly inferred.
After actual testing, according to this numerical calculation process, the average solving speed of a 20x20 puzzle can be shortened by more than 40%, which is especially suitable for levels with dense "number piles". By the way, the pixel art generated by the hidden pictures in the game is very exquisite. I even cut off the drawn pictures and used them as avatars, which was an unexpected bonus 😂