Ejemplo n.º 1
0
        /// <summary>
        /// 判断是否为5连
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public static Boolean CheckFiveARow(Point point, ChessType type)
        {
            if (ChessRule.CheckDirectOnChess(point, Direction.Down, type) + ChessRule.CheckDirectOnChess(point, Direction.UP, type) + 1 == 5)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.DownLeft, type) + ChessRule.CheckDirectOnChess(point, Direction.UpRight, type) + 1 == 5)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.DownRight, type) + ChessRule.CheckDirectOnChess(point, Direction.UpLeft, type) + 1 == 5)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.Left, type) + ChessRule.CheckDirectOnChess(point, Direction.Right, type) + 1 == 5)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 判断某个点是否为单N
        /// </summary>
        /// <param name="point">点坐标</param>
        /// <param name="count">单几</param>
        /// /// <param name="type">棋子类型</param>
        /// <returns></returns>
        public static Boolean IsSingle(Point point, int count, ChessType type)
        {
            if (ChessRule.CheckDirectOnChess(point, Direction.UP, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.UpLeft, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.Left, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.DownLeft, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.Down, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.DownRight, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.Right, type) + 1 == count)
            {
                return(true);
            }
            if (ChessRule.CheckDirectOnChess(point, Direction.UpRight, type) + 1 == count)
            {
                return(true);
            }


            return(false);
        }