Ejemplo n.º 1
0
        private void Calc()
        {
            string ds = GetOneLine();

            data = new SudoCalc.Panel(ds);
            Calculator.ExpelCandidate(ref data);
            //Calculator.Filler(ref data);
            while (Calculator.Filler(ref data))
            {
                Calculator.ExpelCandidate(ref data);
            }

            if (!data.IsFull())
            {
                SudoCalc.Panel[] debug = Calculator.FindAnswer(data);
                if (Calculator.CancelRequest)
                {
                    Calculator.CancelRequest = false;
                    return;
                }
                //data = Calculator.FindAnswer(data)[0];//TODO:FixMultiAns
                if (debug.Length == 0)
                {
                    MessageBox.Show("此題無解", "計算結果", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                if (debug.Length > 1)
                {
                    MessageBox.Show("此題多解,將只會顯示第一解。", "計算結果", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                data = debug[0];
            }
        }