Bool checkline (point P1, point P2) {int X, Y, T; // If the X axis is the same, if the Y axis is the same, one point is null, and another point is null if (p1.x = p2.x) & (p1.y = p2.y) & (chessdata [p1.y] [p1.x] = 0) & (chessdata [p2.y] [p2.x] = 0 )) {return turn;} // If the P1 axis is smaller than 0 and greater than 18 or the P2 axis is smaller than 0 and greater than 18 else if (p1.x <0) | (p1.x> 18) | (p1.y <0) | (p1.y> 10) | (p2.x <0) | (p2.x> 18) | (p2.y <0) | (p2.y> 10) {return false;} If (p1.x = p2.x) // if one point is the same as the other X axis {If (p1.y> p2.y) // If the score is low, (if the result of the judgment is below The above is the same, and we will judge from the above pawn) {T = p1.y; p1.y = p2.y; p2.y = T ;} // exchange the y values of P1 and P2 // if the above is not true, execute the following for (y = p1.y; y <= p2.y; y ++) // If the X axis is the same, it traverses the Y axis, that is, whether there is a pawn channel under P1 {If (chessdata [y] [p1.x]! = 0) {return false;} // if there is something under P1, you cannot directly connect} If (p1.y = p2.y) // If P1 and p2y axes are the same {If (p1.x> p2.x) // if one is the same as the other (if the other is the same as the other one, then, judge from the Front) {T = p1.x; p1.x = p2.x; p2.x = T;} For (x = p1.x; x <p2.x; X ++) // traverse the X axis backward, that is, to determine whether there is a pawn line behind P1 {If (chessdata [p1.y] [x]! = 0) {return false;} // if there is something behind P1, you cannot directly connect} return true; // if you can perform this step, it can be directly connected (one line )}