Example #1
0
        public QuoridorAction GetNextPolicy(Enum_PlayerType PlayerType, EnumNowPlayer Player, out string ErrorHint)
        {
            ErrorHint = "";
            QuoridorAction NextPolicy = new QuoridorAction(NowAction.Action_Wait, new Point(-1, -1));

            #region 玩家决策
            if (PlayerType == Enum_PlayerType.Human)
            {
                while (!HumanPolicyFinish)
                {
                }
                ErrorHint = MousePointToPolicyPoint(HumanMouseClickPoint);
                if (ErrorHint == "OK")
                {
                    NextPolicy.ActionPoint = HumanPolicyLocation;
                    if (HumanPolicyAction == NowAction.Action_Move_Player1 || HumanPolicyAction == NowAction.Action_Move_Player2)
                    {
                        if (Player == EnumNowPlayer.Player1)
                        {
                            HumanPolicyAction = NowAction.Action_Move_Player1;
                        }
                        else
                        {
                            HumanPolicyAction = NowAction.Action_Move_Player2;
                        }
                    }
                    NextPolicy.PlayerAction = HumanPolicyAction;
                    HumanPolicyFinish       = false;
                }
            }
            #endregion
            # region AI决策
            else if (PlayerType == Enum_PlayerType.AI)
Example #2
0
            /// <summary>
            /// 画挡板
            /// </summary>
            /// <param name="Gr">绘画类</param>
            /// <param name="NA">当前动作状态</param>
            /// <param name="row">第row行挡板</param>
            /// <param name="col">第col列挡板</param>
            /// <param name="BoardColor">挡板颜色</param>
            /// <param name="BoardWidth">挡板宽度,最好和棋盘框长度一样</param>
            public void DrawBoard(Graphics Gr, NowAction NA, int row, int col, Color BoardColor)
            {
                int BlockWidth = _FormDraw.CB_size_width / 8;

                if (NA == NowAction.Action_PlaceVerticalBoard)
                {
                    Pen pen = new Pen(BoardColor, CB_LineWidth);//定义画笔,里面的参数为画笔的颜色

                    int x0 = StartLocation_X, y0 = StartLocation_Y;
                    int x1 = StartLocation_X, y1 = StartLocation_Y;

                    x0 = Convert.ToInt16(x0 + CB_LineWidth / 2 + col * CB_BlockWidth);
                    y0 = Convert.ToInt16(y0 + CB_LineWidth / 2 + row * CB_BlockWidth);
                    x1 = x0;
                    y1 = Convert.ToInt16(y0 + CB_BlockWidth);

                    Gr.DrawLine(pen, x0, y0, x1, y1);
                }
                else if (NA == NowAction.Action_PlaceHorizontalBoard)
                {
                    Pen pen = new Pen(BoardColor, CB_LineWidth);//定义画笔,里面的参数为画笔的颜色

                    int x0 = StartLocation_X, y0 = StartLocation_Y;
                    int x1 = StartLocation_X, y1 = StartLocation_Y;

                    x0 = Convert.ToInt16(x0 + CB_LineWidth / 2 + col * CB_BlockWidth);
                    y0 = Convert.ToInt16(y0 + CB_LineWidth / 2 + row * CB_BlockWidth);
                    x1 = Convert.ToInt16(x0 + CB_BlockWidth);
                    y1 = y0;

                    Gr.DrawLine(pen, x0, y0, x1, y1);
                }
            }
Example #3
0
 private void PlaceHorizontalBoardBTN_Click(object sender, EventArgs e)
 {
     PlayerNowAction = NowAction.Action_PlaceHorizontalBoard;
     PlaceVerticalBoardBTN.Enabled   = false;
     PlaceHorizontalBoardBTN.Enabled = false;
     IfPlaceBoard = true;
     RestartFollow();
 }
Example #4
0
 private void MoveBTN_Click(object sender, EventArgs e)
 {
     if (NowPlayer == EnumNowPlayer.Player1)
     {
         PlayerNowAction = NowAction.Action_Move_Player1;
     }
     else
     {
         PlayerNowAction = NowAction.Action_Move_Player2;
     }
 }
Example #5
0
        /// <summary>
        /// 根据动作更新竖直挡板地图哈希值和横档板地图哈希值
        /// </summary>
        /// <param name="VertivalCode">竖直挡板地图哈希值</param>
        /// <param name="HorizontalCode">横档板地图哈希值</param>
        /// <param name="NA">动作</param>
        /// <param name="ActionLocation_Row">动作位置行</param>
        /// <param name="ActionLocation_Col">动作位置列</param>
        public void RenewHashCode(ref Int64 VertivalCode, ref Int64 HorizontalCode, NowAction NA, int ActionLocation_Row, int ActionLocation_Col)
        {
            int BoardIndex1 = ActionLocation_Row * 7 + ActionLocation_Col;
            int BoardIndex2 = 0;

            if (NA == NowAction.Action_PlaceHorizontalBoard)
            {
                BoardIndex2     = ActionLocation_Row * 7 + ActionLocation_Col + 1;
                HorizontalCode += Convert.ToInt64((Math.Pow(2.0, Convert.ToDouble(BoardIndex1))));
                HorizontalCode += Convert.ToInt64((Math.Pow(2.0, Convert.ToDouble(BoardIndex2))));
            }
            else if (NA == NowAction.Action_PlaceVerticalBoard)
            {
                BoardIndex2   = (ActionLocation_Row + 1) * 7 + ActionLocation_Col;
                VertivalCode += Convert.ToInt64((Math.Pow(2.0, Convert.ToDouble(BoardIndex1))));
                VertivalCode += Convert.ToInt64((Math.Pow(2.0, Convert.ToDouble(BoardIndex2))));
            }
        }
Example #6
0
        /// <summary>
        /// 行动操作,主要是用来改变棋盘状态数组
        /// </summary>
        /// <param name="row">行动的行</param>
        /// <param name="col">行动的列</param>
        /// <param name="NA">行动操作</param>
        /// <returns>行动结果,可不可行</returns>
        public string Action(ref ChessBoard ChessBoard_ToAction, int row, int col, NowAction NA)
        {
            Grid[,] ChessBoardAll = ChessBoard_ToAction.ChessBoardAll;
            switch (NA)
            {
            case NowAction.Action_PlaceVerticalBoard:
                if (col <= 0 || col >= 7 || row >= 6)
                {
                    return("VerticalBoardPlaceError!");
                }
                if (ChessBoardAll[row, col].IfLeftBoard || ChessBoardAll[row + 1, col].IfLeftBoard)
                {
                    return("This has a VerticalBoard!");
                }
                if (ChessBoardAll[row + 1, col].IfUpBoard && ChessBoardAll[row + 1, col - 1].IfUpBoard)
                {
                    return("十字交叉违规!");
                }
                ChessBoardAll[row, col].IfLeftBoard     = true;
                ChessBoardAll[row + 1, col].IfLeftBoard = true;
                LookupRoadAlgorithm.ResultSaveTable.RenewHashCode(
                    ref ChessBoard_ToAction.VerticalBoardHashCode,
                    ref ChessBoard_ToAction.HorizontalBoardHashCode,
                    NowAction.Action_PlaceVerticalBoard, row, col);
                return("OK");

            case NowAction.Action_PlaceHorizontalBoard:
                if (row <= 0 || row >= 7 || col >= 6)
                {
                    return("HorizontalBoardPlaceError!");
                }
                if (ChessBoardAll[row, col].IfUpBoard || ChessBoardAll[row, col + 1].IfUpBoard)
                {
                    return("This has a HorizontalBoard!");
                }
                if (ChessBoardAll[row, col + 1].IfLeftBoard && ChessBoardAll[row - 1, col + 1].IfLeftBoard)
                {
                    return("十字交叉违规!");
                }
                ChessBoardAll[row, col].IfUpBoard     = true;
                ChessBoardAll[row, col + 1].IfUpBoard = true;
                LookupRoadAlgorithm.ResultSaveTable.RenewHashCode(
                    ref ChessBoard_ToAction.VerticalBoardHashCode,
                    ref ChessBoard_ToAction.HorizontalBoardHashCode,
                    NowAction.Action_PlaceHorizontalBoard, row, col);
                return("OK");

            case NowAction.Action_Move_Player1:
                return(CheckMove_Change(ref ChessBoard_ToAction, row, col, NowAction.Action_Move_Player1));

            case NowAction.Action_Move_Player2:
                return(CheckMove_Change(ref ChessBoard_ToAction, row, col, NowAction.Action_Move_Player2));

            case NowAction.Action_Wait:
                return("OK");

            default:
                break;
            }
            return("未知……");
        }
Example #7
0
        /// <summary>
        /// 检测该挡板是否能被放下
        /// </summary>
        /// <param name="WhichBoard">放置哪种挡板</param>
        /// <param name="Player">检测哪个玩家会被堵死</param>
        /// <param name="Location_row">玩家的位置行</param>
        /// <param name="Location_col">玩家的位置列</param>
        /// <returns>检测挡板结果</returns>
        public CheckBoardResult CheckBoard(ChessBoard ChessBoard_ToCheck, NowAction WhichBoard, EnumNowPlayer Player, int Location_row, int Location_col)
        {
            CheckBoardResult Result         = new CheckBoardResult();
            ChessBoard       ThisChessBoard = ChessBoard_ToCheck;

            //if (WhichBoard == NowAction.Action_Move_Player1 || WhichBoard == NowAction.Action_Move_Player2)
            //{
            //    Result.HintStr = "OK";
            //    return Result;
            //}
            if (WhichBoard != NowAction.Action_Move_Player1 && WhichBoard != NowAction.Action_Move_Player2)
            {
                if (Player == EnumNowPlayer.Player1 && ChessBoard_ToCheck.NumPlayer1Board <= 0)
                {
                    Result.HintStr = "Player1 No Board";
                    return(Result);
                }
                else if (Player == EnumNowPlayer.Player2 && ChessBoard_ToCheck.NumPlayer2Board <= 0)
                {
                    Result.HintStr = "Player2 No Board";
                    return(Result);
                }
            }
            ///为了不改变原状态而暂存原状态以便后续恢复
            ChessBoard ChessBoardBuff = new ChessBoard();

            ChessBoard.SaveChessBoard(ref ChessBoardBuff, ThisChessBoard);

            //假设能放挡板
            string Hint = Action(ref ThisChessBoard, Location_row, Location_col, WhichBoard);

            if (Hint == "OK")
            {
                int disbuff1 = 0, disbuff2 = 0;
                disbuff1 = AstarEngine.AstarRestart(ThisChessBoard, EnumNowPlayer.Player1
                                                    , ThisChessBoard.Player1Location.X, ThisChessBoard.Player1Location.Y);
                disbuff2 = AstarEngine.AstarRestart(ThisChessBoard, EnumNowPlayer.Player2
                                                    , ThisChessBoard.Player2Location.X, ThisChessBoard.Player2Location.Y);
                Result.P1Distance = disbuff1;
                Result.P2Distance = disbuff2;
                if (disbuff1 >= 999 && disbuff2 < 999)
                {
                    Hint = "Player1 No Road!";
                }
                else if (disbuff2 >= 999 && disbuff1 < 999)
                {
                    Hint = "Player2 No Road!";
                }
                else if (disbuff1 >= 999 && disbuff2 >= 999)
                {
                    Hint = "Player1&Player2 No Road!";
                }
            }
            if (Hint != "OK")
            {
                ChessBoard.ResumeChessBoard(ref ThisChessBoard, ChessBoardBuff);
                Result.HintStr = Hint;
                return(Result);
            }

            ChessBoard.ResumeChessBoard(ref ThisChessBoard, ChessBoardBuff);
            Result.HintStr = "OK";
            return(Result);
        }
Example #8
0
        /// <summary>
        /// 检测能否执行移动,Change代表检测成功后会执行这次移动,改变棋盘ChessBoard_ToCheck
        /// </summary>
        /// <param name="ChessBoard_ToCheck">待检测的棋盘</param>
        /// <param name="row">移动的行</param>
        /// <param name="col">移动的列</param>
        /// <param name="NA">移动类型</param>
        /// <returns></returns>
        public string CheckMove_Change(ref ChessBoard ChessBoard_ToCheck, int row, int col, NowAction NA)
        {
            Grid[,] ChessBoardAll = ChessBoard_ToCheck.ChessBoardAll;
            if (ChessBoard_ToCheck.ChessBoardAll[row, col].GridStatus != Grid.GridInsideStatus.Empty)
            {
                return("This Not Empty");
            }

            Grid.GridInsideStatus ActionPlayer  = Grid.GridInsideStatus.Empty;
            Grid.GridInsideStatus AnotherPlayer = Grid.GridInsideStatus.Empty;

            if (NA != NowAction.Action_Move_Player1 &&
                NA != NowAction.Action_Move_Player2)
            {
                return("Error");
            }

            if (NA == NowAction.Action_Move_Player1)
            {
                ActionPlayer  = Grid.GridInsideStatus.Have_Player1;
                AnotherPlayer = Grid.GridInsideStatus.Have_Player2;
            }
            else
            {
                ActionPlayer  = Grid.GridInsideStatus.Have_Player2;
                AnotherPlayer = Grid.GridInsideStatus.Have_Player1;
            }

            //前扫一格
            if (row >= 1 &&
                !(ChessBoardAll[row, col].IfUpBoard))   //上扫
            {
                if (ChessBoardAll[row - 1, col].GridStatus == ActionPlayer)
                {
                    ChessBoardAll[row - 1, col].GridStatus = Grid.GridInsideStatus.Empty;
                    ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                    ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                    return("OK");
                }
                else if (ChessBoardAll[row - 1, col].GridStatus == AnotherPlayer)
                {
                    if (col >= 1 &&
                        ChessBoardAll[row - 1, col - 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row - 1, col].IfLeftBoard))   //左扫
                    {
                        ChessBoardAll[row - 1, col - 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (col <= 5 &&
                        ChessBoardAll[row - 1, col + 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row - 1, col + 1].IfLeftBoard))   //右扫
                    {
                        ChessBoardAll[row - 1, col + 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (row >= 2 &&
                        ChessBoardAll[row - 2, col].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row - 1, col].IfUpBoard))   //上扫
                    {
                        ChessBoardAll[row - 2, col].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                }
            }

            if (row <= 5 &&
                !(ChessBoardAll[row + 1, col].IfUpBoard))   //下扫
            {
                if (ChessBoardAll[row + 1, col].GridStatus == ActionPlayer)
                {
                    ChessBoardAll[row + 1, col].GridStatus = Grid.GridInsideStatus.Empty;
                    ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                    ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                    return("OK");
                }
                else if (ChessBoardAll[row + 1, col].GridStatus == AnotherPlayer)
                {
                    if (col >= 1 &&
                        ChessBoardAll[row + 1, col - 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row + 1, col].IfLeftBoard))   //左扫
                    {
                        ChessBoardAll[row + 1, col - 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (col <= 5 &&
                        ChessBoardAll[row + 1, col + 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row + 1, col + 1].IfLeftBoard))   //右扫
                    {
                        ChessBoardAll[row + 1, col + 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }

                    if (row <= 4 &&
                        ChessBoardAll[row + 2, col].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row + 2, col].IfUpBoard))   //下扫
                    {
                        ChessBoardAll[row + 2, col].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                }
            }
            if (col >= 1 &&
                !(ChessBoardAll[row, col].IfLeftBoard))   //左扫
            {
                if (ChessBoardAll[row, col - 1].GridStatus == ActionPlayer)
                {
                    ChessBoardAll[row, col - 1].GridStatus = Grid.GridInsideStatus.Empty;
                    ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                    ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                    return("OK");
                }
                else if (ChessBoardAll[row, col - 1].GridStatus == AnotherPlayer)
                {
                    if (col >= 2 &&
                        ChessBoardAll[row, col - 2].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row, col - 1].IfLeftBoard))   //左扫
                    {
                        ChessBoardAll[row, col - 2].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (row <= 5 &&
                        ChessBoardAll[row + 1, col - 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row + 1, col - 1].IfUpBoard))   //下扫
                    {
                        ChessBoardAll[row + 1, col - 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (row >= 1 &&
                        ChessBoardAll[row - 1, col - 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row, col - 1].IfUpBoard))   //上扫
                    {
                        ChessBoardAll[row - 1, col - 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                }
            }
            if (col <= 5 &&
                !(ChessBoardAll[row, col + 1].IfLeftBoard))   //右扫
            {
                if (ChessBoardAll[row, col + 1].GridStatus == ActionPlayer)
                {
                    ChessBoardAll[row, col + 1].GridStatus = Grid.GridInsideStatus.Empty;
                    ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                    ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                    return("OK");
                }
                else if (ChessBoardAll[row, col + 1].GridStatus == AnotherPlayer)
                {
                    if (col <= 4 &&
                        ChessBoardAll[row, col + 2].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row, col + 2].IfLeftBoard))   //右扫
                    {
                        ChessBoardAll[row, col + 2].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus     = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (row <= 5 &&
                        ChessBoardAll[row + 1, col + 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row + 1, col + 1].IfUpBoard))   //下扫
                    {
                        ChessBoardAll[row + 1, col + 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                    if (row >= 1 &&
                        ChessBoardAll[row - 1, col + 1].GridStatus == ActionPlayer &&
                        !(ChessBoardAll[row, col + 1].IfUpBoard))   //上扫
                    {
                        ChessBoardAll[row - 1, col + 1].GridStatus = Grid.GridInsideStatus.Empty;
                        ChessBoardAll[row, col].GridStatus         = ActionPlayer;
                        ChangeP1P2Location(ref ChessBoard_ToCheck, row, col, NA);
                        return("OK");
                    }
                }
            }

            return("MoveError");
        }
Example #9
0
 /// <summary>
 /// 改变P1或P2棋子位置
 /// </summary>
 /// <param name="ChessBoard_ToCheck">待检测的棋盘</param>
 /// <param name="row">移动的行</param>
 /// <param name="col">移动的列</param>
 /// <param name="NA">移动类型</param>
 public void ChangeP1P2Location(ref ChessBoard ChessBoard_ToCheck, int row, int col, NowAction NA)
 {
     if (NA == NowAction.Action_Move_Player1)
     {
         ChessBoard_ToCheck.Player1Location = new Point(row, col);
     }
     else
     {
         ChessBoard_ToCheck.Player2Location = new Point(row, col);
     }
 }
Example #10
0
        public void QuoridorGame_Do()
        {
            #region 配置初始棋盘
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[0, 3].GridStatus = Grid.GridInsideStatus.Empty;
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[1, 3].GridStatus = Grid.GridInsideStatus.Have_Player1;
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[6, 3].GridStatus = Grid.GridInsideStatus.Empty;
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[5, 3].GridStatus = Grid.GridInsideStatus.Have_Player2;

            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[1, 3].IfUpBoard = true;
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[1, 4].IfUpBoard = true;
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[6, 2].IfUpBoard = true;
            //NowGame.QuoridorEva.ThisChessBoard.ChessBoardAll[6, 3].IfUpBoard = true;

            ////NowQuoridor.ThisChessBoard.ChessBoardAll[2, 3].IfLeftBoard = true;
            ////NowQuoridor.ThisChessBoard.ChessBoardAll[3, 3].IfLeftBoard = true;
            ////NowQuoridor.ThisChessBoard.ChessBoardAll[2, 4].IfLeftBoard = true;
            ////NowQuoridor.ThisChessBoard.ChessBoardAll[3, 4].IfLeftBoard = true;

            //NowGame.QuoridorEva.ThisChessBoard.NumPlayer1Board = 16 - 2;
            //NowGame.QuoridorEva.ThisChessBoard.NumPlayer2Board = 16 - 2;


            //NowGame.QuoridorEva.ThisChessBoard.Player1Location = new Point(1, 3);
            //NowGame.QuoridorEva.ThisChessBoard.Player2Location = new Point(5, 3);
            #endregion
            BlackBoardNumLB.Text = NowGame.QuoridorEva.ThisChessBoard.NumPlayer2Board.ToString();
            WhiteBoardNumLB.Text = NowGame.QuoridorEva.ThisChessBoard.NumPlayer1Board.ToString();

            //刷新初始棋盘
            NowGame.QuoridorEva.ThisChessBoard.DrawNowChessBoard(ref Gr, ChessWhitePB, ChessBlackPB);
            ChessBoardPB.Refresh();

            EnumNowPlayer NowPlayer = EnumNowPlayer.Player1;
            while (true)
            {
                string Hint = NowGame.DoOncePolicy(ref NowPlayer);
                if (Hint == "Player1 Success!" || Hint == "Player2 Success!")
                {
                    NowGame.QuoridorEva.ThisChessBoard.DrawNowChessBoard(ref Gr, ChessWhitePB, ChessBlackPB);
                    ChessBoardPB.Refresh();
                    MessageBox.Show(Hint);
                    System.Environment.Exit(0);
                    break;
                }
                else if (Hint != "OK")
                {
                    TestTB.Text = Hint;
                    #region 取消放置挡板
                    IfPlaceBoard = false;
                    if (NowPlayer == EnumNowPlayer.Player1)
                    {
                        PlayerNowAction = NowAction.Action_Move_Player1;
                    }
                    if (NowPlayer == EnumNowPlayer.Player2)
                    {
                        PlayerNowAction = NowAction.Action_Move_Player2;
                    }
                    PlaceVerticalBoardBTN.Enabled   = true;
                    PlaceHorizontalBoardBTN.Enabled = true;

                    IfShowFollow      = false;
                    VBoardPB.Visible  = false;
                    VBoardPB.Location = new Point(837, 569);
                    HBoardPB.Visible  = false;
                    HBoardPB.Location = new Point(837, 569);
                    #endregion
                    continue;
                }
                #region 取消放置挡板
                IfPlaceBoard = false;
                if (NowPlayer == EnumNowPlayer.Player1)
                {
                    PlayerNowAction = NowAction.Action_Move_Player1;
                }
                if (NowPlayer == EnumNowPlayer.Player2)
                {
                    PlayerNowAction = NowAction.Action_Move_Player2;
                }
                PlaceVerticalBoardBTN.Enabled   = true;
                PlaceHorizontalBoardBTN.Enabled = true;

                IfShowFollow      = false;
                VBoardPB.Visible  = false;
                VBoardPB.Location = new Point(837, 569);
                HBoardPB.Visible  = false;
                HBoardPB.Location = new Point(837, 569);
                #endregion
                if (NowPlayer == EnumNowPlayer.Player2 && NowGame.P1Type == QuoridorGame.Enum_PlayerType.AI)
                {
                    NowGame.PolicyRootNodeList.Add(NowGame.NodeToTreeView);
                }
                else if (NowPlayer == EnumNowPlayer.Player1 && NowGame.P2Type == QuoridorGame.Enum_PlayerType.AI)
                {
                    NowGame.PolicyRootNodeList.Add(NowGame.NodeToTreeView);
                }
                TestTB.Text = Hint;
                NowGame.QuoridorEva.ThisChessBoard.DrawNowChessBoard(ref Gr, ChessWhitePB, ChessBlackPB);
                ChessBoardPB.Refresh();
                #region 更新状态提示界面
                if (NowPlayer == EnumNowPlayer.Player1)
                {
                    ActionPlayerLabel.Text = "白子";
                    BlackBoardNumLB.Text   = NowGame.QuoridorEva.ThisChessBoard.NumPlayer2Board.ToString();
                    WhiteBoardNumLB.Text   = NowGame.QuoridorEva.ThisChessBoard.NumPlayer1Board.ToString();
                }
                if (NowPlayer == EnumNowPlayer.Player2)
                {
                    ActionPlayerLabel.Text = "黑子";
                    BlackBoardNumLB.Text   = NowGame.QuoridorEva.ThisChessBoard.NumPlayer2Board.ToString();
                    WhiteBoardNumLB.Text   = NowGame.QuoridorEva.ThisChessBoard.NumPlayer1Board.ToString();
                }
                #endregion
            }
        }