private void downPiece(int X, int Y) { if (!isWinBool) { if (color) { mainboard.pieceNum[X, Y] = 1; addBlack(X * 40 + 10, Y * 40 + 10); var win = isWin(X, Y); if (win == true) { logText.AppendText(DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]")); logText.AppendText("游戏结束,黑棋胜利\n"); if (isAi) { ai = new Ai(); ai.start(); } mainboard.clearPiece(); addButton(); isWinBool = true; color = true; } else { color = false; } } else { mainboard.pieceNum[X, Y] = 2; addWhite(X * 40 + 10, Y * 40 + 10); var win = isWin(X, Y); if (win == true) { logText.AppendText(DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]")); logText.AppendText("游戏结束,白棋胜利\n"); if (isAi) { ai = new Ai(); ai.start(); } mainboard.clearPiece(); addButton(); isWinBool = true; color = true; } else { color = true; if (isAi) { isWaiting = true; var down = ai.turn(X, Y); downPiece(down[0], down[1]); isWaiting = false; } } } } }