Exemple #1
0
        public static List <string> GetSubString(string str)
        {
            var result    = new List <string>();
            var locations = StaticTools.GetLocations(str);

            foreach (var location in locations)
            {
                result.Add(StaticTools.SetZero(str, location));
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="initValues">数独初盘</param>
        /// <param name="initLists">剩余的有数据的位置</param>
        public SudokuMarket(List <List <int> > initValues)
        {
            this.initValues = initValues;


            var tempList = StaticTools.GetLocations(initValues);

            this.initLists = tempList;
            rowDatas       = FilledDatas();
            columnDatas    = FilledDatas();
            blockDatas     = FilledDatas();
            InitCells();
        }
Exemple #3
0
        /// <summary>
        /// 是否是珍珠题
        /// </summary>
        /// <param name="newGens"></param>
        /// <returns></returns>
        /// 900400613320190700000000009000017008000000000700360000800000000009045086253001004 应该fanhuiTrue
        public static bool IsPearl(string newGens)
        {
            var a = new DanceLink().isValid(newGens);

            if (!a)
            {
                return(false);
            }
            foreach (var subString in StaticTools.GetSubString(newGens))
            {
                if (!new DanceLink().isValid(subString))
                {
                    continue;
                }
                return(false);
            }
            return(true);
        }
Exemple #4
0
        public void GetAnswerByForce()
        {
            var s = new DanceLink().do_solve(StrExpress);

            if (s.Length == 81)
            {
                var resultList = StaticTools.StringToList(s);

                for (int i = 0; i < 9; i++)
                {
                    for (int j = 0; j < 9; j++)
                    {
                        var loction = "postion_" + i + "_" + j;
                        if (cellInfos[loction].Value == 0)
                        {
                            cellInfos[loction].SetValue(resultList[i][j]);
                        }
                    }
                }
            }
        }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="initValues">数独初盘</param>
 /// <param name="initLists">剩余的有数据的位置</param>
 public SudokuMarket(string initValues) : this(StaticTools.StringToList(initValues))
 {
 }
Exemple #6
0
 public static bool IsVaildSudoku(List <List <int> > question)
 {
     return(!String.IsNullOrEmpty(new DanceLink().do_solve(StaticTools.ListToString(question))));
 }