예제 #1
0
 /// <summary>
 /// 检查四个方向上,是否有子
 /// </summary>
 /// <param name="point"></param>
 /// <returns></returns>
 public static Boolean checkPoint(Point point, int count)
 {
     return(AIRule.CheckDirectOnChess(point, Direction.Down, count) ||
            AIRule.CheckDirectOnChess(point, Direction.DownLeft, count) ||
            AIRule.CheckDirectOnChess(point, Direction.DownRight, count) ||
            AIRule.CheckDirectOnChess(point, Direction.Left, count) ||
            AIRule.CheckDirectOnChess(point, Direction.Right, count) ||
            AIRule.CheckDirectOnChess(point, Direction.UP, count) ||
            AIRule.CheckDirectOnChess(point, Direction.UpLeft, count) ||
            AIRule.CheckDirectOnChess(point, Direction.UpRight, count));
 }
예제 #2
0
        /// <summary>
        /// 计算单子威力
        /// </summary>
        /// <param name="point"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private int SinglePower(Point point, ChessType type)
        {
            //如果己方为黑子
            if (AIType == ChessType.BLACK && AIType == type)
            {
                //判断禁手
                if (ChessRule.CheckAbort3_3())
                {
                    return(int.MinValue);
                }

                if (ChessRule.CheckAbort4_4())
                {
                    return(int.MinValue);
                }

                if (ChessRule.CheckAbortLong())
                {
                    return(int.MinValue);
                }
            }
            //判断是否为5连
            if (AIRule.CheckFiveARow(point, type))
            {
                return((type == AIType) ? 100 : -100);
            }

            //判断是否为活4
            if (AIRule.IsActive(point, 4, type))
            {
                return((type == AIType) ? 100 : -100);
            }

            //判断是否为单4
            if (AIRule.IsSingle(point, 4, type))
            {
                return((type == AIType) ? 90 : -90);
            }

            //判断是否为单3
            if (AIRule.IsSingle(point, 3, type))
            {
                return((type == AIType) ? 9 : -9);
            }

            //判断是否为活3
            if (AIRule.IsActive(point, 3, type))
            {
                return((type == AIType) ? 90 : -90);
            }
            int commonPower = AIRule.CommonPower(point, type);

            return((type == AIType) ? commonPower : (commonPower * -1));
        }