Five son chess banquet judgment algorithm

xiaoxiao2021-04-07  371

The judgment of the ban is more complicated, and the algorithm for judging the prohibition is to analyze the chess type of chess to find the appropriate search method.

First analyze the chess type.

First, consider the chess type that constitutes a long-term prohibition, and the long-connected chess type is simple, and can be summarized as one, i.e., connected to the sixi or more. Once this chess type is found, it is judged as a long and lifting.

Consider the posterity of the four-four ban hands, three three prohibited. It is to be determined whether a certain child constitutes a four-fourth banner (or three-three prohibited hand), and only two or more of the two or more fourth (or live three) will be generated after this. Therefore, it is necessary to correctly judge the four-four ban hands, and the three three prohibitions are to correctly judge the four, live four and live three.

Consider the definition of the four, live four and live three. The fourth is that only one point can be fifth. Here we refer to the key point. Similarly, there are two key points constituting the live four, and there is a key point for living three. Figure

11

,

A, B

Two points are the key points that make up live four, and

12

,

a

The point is the key point constituting live three.

Figure 11

Figure

12

The following is an analysis of each chess type and a key point.

1

Live four:

Only one chess type of living four

,

Figure

13

Figure

13

This kind of chess type is really constituent to live four or two spaces (ie

A, B

Point) must be a point of black chess, that is

A, B

Do not constitute a ban after you have a black.

2

, Rush four:

Form two kinds of chess types, as shown

14

And map

15

Figure

14

Figure

15

These two chess types really constitute the conditions of the flour, which is the middle space (ie

a

Point) must be a point of black chess, that is

a

There will be no ban after the down.

3

Live three:

There are two kinds of chess shapes to form a live three.

16

And map

In one

Figure

16

Figure

In one

among them,

a

Point is the key point,

B, C

The point can be boundary, no children or white chess, but can't be black chess.

These two chess types really constitute the conditions of live three

a

Point must be a point where black chess, that is

a

Do not constitute a ban after the down,

M, N

Does not construct a ban on two points, because when

a

After putting it in the black child, regardless of

M

Point or

n

Pointing a black child, it will form five consecutive, that is, winning, does not constitute a banner.

So we want to judge whether a chess type constitutes a four, live four or live three, and it is necessary to judge whether it is possible to rush four, live four or live game, to judge whether it is black. Chess, that is, to judge whether the key point does not constitute a new prohibition point, this step can be implemented in the program.

Chess analysis is done, we have to consider choosing a suitable algorithm accordingly.

Based on the accuracy of the forbidden analysis, we need to record the number of consecutive black chess pieces adjacent to the point to be judged, and record the number of contiguous blacks after recording, and The number of consecutive spaces after the subsequent, and the number of contiguous blacks after it. So you can say that the depth of search is to achieve

5

Floor.

When determining the cash of the critical point, the recursive method is used to determine whether it is not a ban.

Thus, we can draw the ideas of the banner to determine the algorithm.

Step 1: Put the point to be judged to black and chess;

Step 2: Search for the surrounding chessboard to be judged;

Step 3: Restore the chessboard;

Step 4: Use the search results to analyze the directions in turn, it is judged whether or not the chess type generated after the black chess is placed in a chess shape that may constitute a live four, rush four, live three. If a long connection is formed, it is determined to be a banner, and return to the long link. If the formation may be live four, rush four, live three chess, determine if the key point can be, if not, the board statistics plus 1, reverse, the next direction is judged until the end of the direction analysis . Step 5: If the four, the statistics of the stroke type are greater than 1, return to the four-four prohibited logo, if the statistics of the live three-chess type is greater than 1, return to the three three prohibits logo. The rest is returned to non-disabled logo.

Source code:

转载请注明原文地址:https://www.9cbs.com/read-132522.html

New Post(0)