private void Form1_Load(object sender, EventArgs e) { //Initializatize the chess //初始化棋盘 for (int i = 0; i < 21; i++) { for (int j = 0; j < 21; j++) { main_chess[i, j] = new GobangPoint(); } } Richard_Hu = new ComputerAI_Richard_Hu(main_chess); }
private int GetWeightSingle(int Direction, int x, int y, GobangPlayer player) { //定义九个端子 GobangPoint[] LEFT_TO_RIGHT = new GobangPoint[9]; if (Direction == 0) { for (int i = 0; i < 9; i++) { LEFT_TO_RIGHT[i] = GetClassPoint(x + i - 4, y, player); } } else if (Direction == 1) { for (int i = 0; i < 9; i++) { LEFT_TO_RIGHT[i] = GetClassPoint(x, y + i - 4, player); } } else if (Direction == 2) { for (int i = 0; i < 9; i++) { LEFT_TO_RIGHT[i] = GetClassPoint(x + i - 4, y + i - 4, player); } } else { for (int i = 0; i < 9; i++) { LEFT_TO_RIGHT[i] = GetClassPoint(x - (i - 4), y + i - 4, player); } } GobangPlayer player_enemy = GobangPlayer.Player1; if (player == GobangPlayer.Player1) { player_enemy = GobangPlayer.Player2; } GobangPoint OwnPawn = new GobangPoint() { GobangPlayer = player }; GobangPoint OtherPawn = new GobangPoint() { GobangPlayer = player_enemy }; //综合考虑所有的情况 if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7].IsEmpty) { return(1); } //五子 if (LEFT_TO_RIGHT[0] == OwnPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn) { return(200); } if (LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn) { return(200); } if (LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn) { return(200); } if (LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn) { return(200); } if (LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8] == OwnPawn) { return(200); } //四子两头空 if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(50); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(50); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty) { return(50); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8].IsEmpty) { return(50); } //o*o*o*o if (LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7] == OwnPawn) { return(50); } //四子一头空 if (LEFT_TO_RIGHT[0] == OtherPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(12); } if (LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(12); } if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty) { return(12); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8].IsEmpty) { return(12); } if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(12); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OtherPawn) { return(12); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OtherPawn) { return(12); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8] == OtherPawn) { return(12); } //1 if (LEFT_TO_RIGHT[0] == OwnPawn && LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[0] == OwnPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[0] == OwnPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty) { return(11); } if (LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7] == OwnPawn) { return(11); } if (LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty && LEFT_TO_RIGHT[8] == OwnPawn) { return(11); } //四子两头堵 if (LEFT_TO_RIGHT[0] == OtherPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(0); } if (LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OtherPawn) { return(0); } if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OtherPawn) { return(0); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8] == OtherPawn) { return(0); } //三子两头空============================================= //以下三种情况削减得分 if (LEFT_TO_RIGHT[0] == OtherPawn && LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OtherPawn) { return(7); } if ( LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty && LEFT_TO_RIGHT[8] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(10); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(10); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty) { return(10); } //特殊处理 if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(9); } if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(9); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(9); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty) { return(9); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8].IsEmpty) { return(9); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8].IsEmpty) { return(9); } //三子一头空================================================== if (LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6].IsEmpty) { return(8); } if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7].IsEmpty) { return(8); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty && LEFT_TO_RIGHT[8].IsEmpty) { return(8); } if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(8); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OtherPawn) { return(8); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OtherPawn) { return(8); } //特殊情况 if (LEFT_TO_RIGHT[0] == OtherPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[0] == OtherPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[5] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[6] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[7] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[8] == OtherPawn) { return(7); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[8] == OtherPawn) { return(7); } //特殊状态的冲三 if (LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[8] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[6].IsEmpty) { return(7); } if (LEFT_TO_RIGHT[0] == OwnPawn && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3].IsEmpty) { return(7); } //三子两头堵==================================== if (LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(0); } if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OtherPawn) { return(0); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[7] == OtherPawn) { return(0); } //两子两头空========================================== if (LEFT_TO_RIGHT[0] == OwnPawn && LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(6); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[7].IsEmpty && LEFT_TO_RIGHT[8] == OwnPawn) { return(6); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(5); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(5); } if (LEFT_TO_RIGHT[1].IsEmpty && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(5); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[7].IsEmpty) { return(5); } if (LEFT_TO_RIGHT[0].IsEmpty && LEFT_TO_RIGHT[1] == OwnPawn && LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(5); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[7] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[8].IsEmpty) { return(5); } //两子一头空============================================== if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(4); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6].IsEmpty) { return(4); } if (LEFT_TO_RIGHT[2].IsEmpty && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(4); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OtherPawn) { return(4); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[7].IsEmpty) { return(3); } if (LEFT_TO_RIGHT[1] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(3); } if (LEFT_TO_RIGHT[5] == OtherPawn && LEFT_TO_RIGHT[2] == OwnPawn && LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[1].IsEmpty) { return(3); } if (LEFT_TO_RIGHT[7] == OtherPawn && LEFT_TO_RIGHT[6] == OwnPawn && LEFT_TO_RIGHT[5].IsEmpty && LEFT_TO_RIGHT[3].IsEmpty) { return(3); } //两子两头堵 if (LEFT_TO_RIGHT[2] == OtherPawn && LEFT_TO_RIGHT[3] == OwnPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(0); } if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OwnPawn && LEFT_TO_RIGHT[6] == OtherPawn) { return(0); } //一子两头空 if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5].IsEmpty) { return(1); } //一子一头空 if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5].IsEmpty) { return(2); } if (LEFT_TO_RIGHT[3].IsEmpty && LEFT_TO_RIGHT[5] == OtherPawn) { return(2); } //一子两头堵 if (LEFT_TO_RIGHT[3] == OtherPawn && LEFT_TO_RIGHT[5] == OtherPawn) { return(0); } return(1); }