As a strategy game, mine clearance requires precise judgment by gamers. Currently, the fastest official record for advanced mine clearance is 33.95 seconds, and the intermediate level is 8.5 seconds maintained by a Polish player. The initial record is one second, and many people in the world have reached this point. The initial clearance is completed within one second. The estimated probability is between 0.00058% and 0.00119% (luck problem). The most possible method is to directly click the four corners of the square. What I have done in this article is to find out the law between Thunder and thunder, and think deeply about its connotation. In the future, you will be able to reduce the gap with records in the face of mine clearance!
Start with a simple minefield
It is a primary minefield with two mines marked. Can you scan the remaining mines?
After investigation, the location of the six mines in the minefield can be easily determined:
Let's take a look at a simple "Minefield ":
By scanning each square gradually, we will find that the two grids on the leftmost and rightmost must be mines, the second space on the left and the second blank lattice on the right are also mines. Due to the relationship between numbers 1, counting 3rd grids from the left and 3rd grids from the right are not mines. Opening a grid must be number 1 ...... In this way, you will find that the two empty grids at the center, whether there are mines or not, are inconsistent with the numbers on the surrounding grids. That is to say, such a minefield has bugs, which are unsolvable.
Logic gate in the minefield
How can we determine if a minefield has a bug? How can we determine the specific location of mines in a minefield? Do we have to scan the minefield from start to end?
In fact, there is a rule in these mines. We used mathematical methods to analyze the minefield in the above example:
In the two darears mentioned earlier, the unopened grids are marked with the letters X and x '. We can see that when the grid of X has a ray, the grid of X' must have no mine, and vice versa. If the leftmost blank lattice is used as the input, and the rightmost lattice is used as the output, the input and output results must be the same or opposite. If it is the opposite, it is equivalent to a not ("not") gate electronic component. If it is the same, it will be interesting. Such a minefield will have the nature of circuit wires!
Here, the minefield is regarded as a digital logic circuit. A circuit that performs logical operations such as "or", "and", and "Non" is called a logic gate. Any complex logical circuit can be composed of these logic gates.
A logical gate is a basic component of an integrated circuit. A simple logic gate can be composed of a transistor. The combination of these transistors enables high and low levels representing two models to generate signals after passing through them. High and low levels can represent true and false in logic or 0 and 1 in binary, thus implementing logical operations. Specific to the mine clearance game, that is, the logic gate can be used to determine the specific location of mines in a series of grids, and it is as accurate and fast as circuit conduction.
Common (also used in mine clearance) logic gates include "and", "or", and "Non. By combining them, you can achieve more complex operations-to complete mine clearance in complex circumstances, which is much less time than a mine clearance method that is slowly advancing according to rules.
Precise judgment in complex mined areas
In a simple minefield, let's have a practical drill with the discovery pattern. It is a typical minefield in advanced mine clearance games:
Can you directly point out the presence or absence of mines in the yellow grid without opening the grid? If you change the Minefield a bit at will-a grid in the upper left corner is moved down, what is the result?
You may need to consider the global situation, and gradually infer from a certain point and scan all the mines to determine the situation. When the minefield changes any time, you have to come back to answer the question again. This is undoubtedly a huge cost burden.
In fact, we can quickly give the answer: There is no thunder in the yellow grid of the first minefield. There must be a ray in the yellow lattice of the second minefield.
How is this done? In fact, the above logic gate is introduced into this complicated minefield, and everything will become simple and clear.
When the record area is close to the boundary, it can be directly determined that the flag is inserted in the mine location, and the remaining positions are marked with different letters. Think of a grid with mines as 1 and those without mines as 0. The leftmost grid (u, v) is used as the input, and the rightmost grid (t) is used as the output. According to the rules of the mine clearance game, the relationship between them is calculated step by step:
(U, v, t) = (1, 1, 1) or (1, 0, 0) or (0, 1, 0) or (0, 0, 0)
Obviously, this minefield is summarized into an and gate, which not only easily resolves this mine clearance problem, but also reveals the law of the minefield. In this way, when you master and practice these logic gate rules in mine clearance, you can achieve a precise and fast "mechanized" mine clearance level. By that time, a new record may be born.
Mathematician's mine clearance Research
Those who abstract the problem of mine clearance to shorten the game time, not just those who have mine clearance fever. Some mathematicians are also very concerned about the mathematical significance behind this game.
A British matcher built a series of electronic components in a clearance game and used electronic circuits to simulate the minefield. He tried to hand over a given minefield pattern to a computer to determine whether it was feasible. With the increase in the number of cells, the computer's computing workload is not growing fast, that is, the p problem. If the computing workload increases rapidly, it is the NP problem. The computer determines whether a minefield can be solved. This type of problem is a p problem.
For several basic circuit components (and, or, not), if many such components are combined and connected to each other, many input and output ports are generated. It is called the SAT problem to determine which output results can be produced and which cannot be generated. It is a classic NP-complete problem.
This problem of British mathematicians is sometimes equivalent to the SAT Problem of a complex electronic circuit, that is, the NP problem. From this point of view, in the face of a giant minefield with thousands or tens of thousands of grids, we should not simply judge whether it is feasible to complete all mine clearance tasks, it may be a big problem that computers cannot afford.