コード例 #1
0
        /// <summary>
        /// AI取点
        /// </summary>
        /// <param name="board"></param>
        /// <param name="step"></param>
        /// <param name="Lev"></param>
        /// <returns></returns>
        public static PieceInfo AIGetNext(Board board, int Lev)
        {
            List <PieceInfo> returnLt  = new List <PieceInfo>();
            BoardInfo        boardInfo = new BoardInfo(board);
            StateEnum        flag      = boardInfo.DeepAnalyze();

            //StateEnum flag = boardInfo.Result;
            returnLt = boardInfo.MaxLt;

            PieceInfo point = returnLt[0];

            //if (ba.MaxLev == LevelEnum.五连1)
            //{
            //    return point;
            //}
            //if (flag == StateEnum.必负 || flag == StateEnum.防)
            //{
            //    point = MoreDefend(ba, board);
            //}
            //else
            //{
            //    point = GetBest(returnLt);
            //}

            return(point);
        }
コード例 #2
0
ファイル: GoBangCL.cs プロジェクト: Ben-lanqing/GoBangXamarin
        /// <summary>
        /// AI取点
        /// </summary>
        /// <param name="board"></param>
        /// <param name="step"></param>
        /// <param name="Lev"></param>
        /// <returns></returns>
        public PieceInfo AIGetNext(Board board, int Lev = 0)
        {
            List <PieceInfo> returnLt  = new List <PieceInfo>();
            BoardInfo        boardInfo = new BoardInfo(board);
            StateEnum        flag      = boardInfo.DeepAnalyze();

            //StateEnum flag = boardInfo.Result;
            returnLt = boardInfo.MaxLt;

            PieceInfo point = returnLt[0];

            if (boardInfo.MaxLev == LevelEnum.Five_1)
            {
                return(point);
            }
            if (flag == StateEnum.Loss || flag == StateEnum.D)
            {
                point = MoreDefend(boardInfo, board);
            }
            else
            {
                point = GetBest(returnLt);
            }

            return(point);
        }