/// <summary> /// 获得PolicyPlayer下一步的决策 /// </summary> /// <param name="ThisChessBoard">当前局面棋盘</param> /// <param name="RootNode">返回的决策树根节点</param> /// <returns>下一步决策动作</returns> public QuoridorAction GetNextPolicy(ChessBoard ThisChessBoard, out GameTreeNode RootNode) { QuoridorAction NextPolicy = new QuoridorAction(NowAction.Action_Wait, new Point(-1, -1)); RootNode = new GameTreeNode(); RootNode.NodePlayer = NowEvalution.ReversePlayer(PolicyPlayer); int P2Dis = NowEvalution.AstarEngine.AstarRestart(ThisChessBoard, EnumNowPlayer.Player2 , ThisChessBoard.Player2Location.X, ThisChessBoard.Player2Location.Y); int P1Dis = NowEvalution.AstarEngine.AstarRestart(ThisChessBoard, EnumNowPlayer.Player1 , ThisChessBoard.Player1Location.X, ThisChessBoard.Player1Location.Y); RootNode.NodeAction.ActionCheckResult.P1Distance = P1Dis; RootNode.NodeAction.ActionCheckResult.P2Distance = P2Dis; if (UsedAlgorithm == Enum_DecisionAlgorithm.AlphaBetaPurning) { #region 配置AB剪枝参数 QuoridorEvalution.ActionListIfSort = ThisABPurningPara.SortActionList; GameTreeNode.SearchFrameWork = GameTreeNode.Enum_GameTreeSearchFrameWork.AlphaBetaPurning; GameTreeNode.IfUseTanslationTable = ThisABPurningPara.UseTT; GameTreeNode.DepthMax = ThisABPurningPara.DepthMax; RootNode.alpha = ThisABPurningPara.AlphaInit; RootNode.beta = ThisABPurningPara.BetaInit; #endregion if (ThisABPurningPara.UseFormulae && NowGameSituation == GameSituation.InitialSituation) { NextPolicy = GetFormulaePolicy(ThisChessBoard); } else { GameTreeNode.CreateGameTree(PolicyPlayer, RootNode, ThisChessBoard, ThisABPurningPara.DepthMax, false); NextPolicy = RootNode.NodeAction; } } return(NextPolicy); }