Exemple #1
0
        /// <summary>
        /// 计算启发式节点值,若为-1表示未计算过,若为-2表示被剪枝,其他情况(正数)越小越好
        /// </summary>
        /// <returns></returns>
        private SKSpecialDecimal cal_node_point()
        {
            SKSpecialDecimal ret;

            if (equation_console == "")
            {
                return(new SKSpecialDecimal());
            }
            if (NodePointStatic.compare_to(new SKSpecialDecimal(-1)) != 0)
            {
                return(NodePointStatic);
            }



            string tmpa = equation_console;

            string[] linesa = spilt_to_3(tmpa);
            string[] linesb = spilt_to_3(tmpa);
            //剪枝0:是否是不可能的加法
            if (Math.Max(linesa[0].Length, linesa[1].Length) != linesa[2].Length &&
                Math.Max(linesa[0].Length, linesa[1].Length) != linesa[2].Length - 1)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            //剪枝1:低位相加是否相同
            int min_last_len = -1;

            string[] last = new string[3];
            for (int i = 0; i < 3; i++)
            {
                last[i] = get_last_num(linesa[i]);
                if (last[i].Length < min_last_len || min_last_len == -1)
                {
                    min_last_len = last[i].Length;
                }
            }
            if (min_last_len > 0)
            {
                SKSpecialDecimal j1   = new SKSpecialDecimal(last[0].Substring(last[0].Length - min_last_len));
                SKSpecialDecimal j2   = new SKSpecialDecimal(last[1].Substring(last[1].Length - min_last_len));
                string           left = (j1 + j2).to_string_only_integer();
                if (left.Length < min_last_len)
                {
                    string tmpstring = "";
                    for (int i = 0; i < min_last_len - left.Length; i++)
                    {
                        tmpstring += "0";
                    }
                    left = tmpstring + left;
                }
                left = left.Substring(left.Length - min_last_len);
                string right = last[2].Substring(last[2].Length - min_last_len);
                if (left != right)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
            }
            //剪枝1.5:对应加数位是否相等或相差1(进位只可能为1)
            int max_line_LEN = max_line_len;

            for (int i = 0; i < max_line_LEN; i++)
            {
                char[] xc      = new char[3];
                int[]  xi      = new int[3];
                bool   do_this = true;
                for (int j = 0; j < 3; j++)
                {
                    xc[j] = get_from_line_end(j, i);
                    if (xc[j] < '0' || xc[j] > '9')
                    {
                        do_this = false;
                        break;
                    }
                    xi[j] = xc[j] - '0';
                }
                if (do_this)
                {
                    int tmpi = (xi[0] + xi[1]) % 10;
                    if (tmpi != xi[2] && (tmpi + 1) % 10 != xi[2])
                    {
                        ret             = new SKSpecialDecimal(-2);
                        NodePointStatic = ret;
                        return(ret);
                    }
                }
            }
            //剪枝2:加数和是否能达到和数或是否超过和数
            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < linesa[i].Length; j++)
                {
                    if (linesa[i][j] >= 'A' && linesa[i][j] <= 'J')
                    {
                        linesa[i] = linesa[i].Replace(linesa[i][j], '9');
                        linesb[i] = linesb[i].Replace(linesb[i][j], '0');
                    }
                }
            }
            for (int j = 0; j < linesa[2].Length; j++)
            {
                if (linesa[2][j] >= 'A' && linesa[2][j] <= 'J')
                {
                    linesa[2] = linesa[2].Replace(linesa[2][j], '0');
                    linesb[2] = linesb[2].Replace(linesb[2][j], '9');
                }
            }
            SKSpecialDecimal g1 = new SKSpecialDecimal(linesa[0]);
            SKSpecialDecimal g2 = new SKSpecialDecimal(linesa[1]);
            SKSpecialDecimal g3 = new SKSpecialDecimal(linesa[2]);
            SKSpecialDecimal h1 = new SKSpecialDecimal(linesb[0]);
            SKSpecialDecimal h2 = new SKSpecialDecimal(linesb[1]);
            SKSpecialDecimal h3 = new SKSpecialDecimal(linesb[2]);

            if ((g1 + g2).compare_to(g3) < 0 || (h1 + h2).compare_to(h3) > 0)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            else
            {
                //剪枝3:判断当前算式可能正确否
                List <int> ava = available_nums();
                if (ava.Count == 0)
                {
                    return(new SKSpecialDecimal(0));
                }
                int avg = (int)Math.Round((double)ava.Sum() / ava.Count);
                if (avg >= 10)
                {
                    avg = 9;
                }
                else if (avg <= 0)
                {
                    avg = 0;
                }
                string tmpb = equation_console;
                for (int i = 0; i < tmpb.Length; i++)
                {
                    if (tmpb[i] >= 'A' && tmpb[i] <= 'J')
                    {
                        tmpb = tmpb.Replace(tmpb[i], (char)(avg + '0'));
                    }
                }
                string[]         lines = spilt_to_3(tmpb);
                SKSpecialDecimal a1    = new SKSpecialDecimal(lines[0]);
                SKSpecialDecimal a2    = new SKSpecialDecimal(lines[1]);
                SKSpecialDecimal b     = new SKSpecialDecimal(lines[2]);
                ret = b - (a1 + a2);
                //SKSpecialDecimal append = new SKSpecialDecimal(available_letters().Count - 1);
                //append.mul_10(max_line_len - 1);
                ret = SKSpecialDecimal.abs(ret) + available_letters().Count;//+append ;
                if (!ret.is_zero() && available_letters().Count == 0)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
                NodePointStatic = ret;
                return(ret);
            }
        }
Exemple #2
0
        private SKSpecialDecimal cal_node_point()
        {
            if (equation_console == "")
            {
                return(new SKSpecialDecimal());
            }
            if (NodePointStatic.compare_to(new SKSpecialDecimal(-1)) != 0)
            {
                return(NodePointStatic);
            }

            SKSpecialDecimal ret = new SKSpecialDecimal();

            string[] lines = spilt_string;
            //剪枝0:是否是不可能的减法
            if (Math.Max(lines[0].Length, lines[1].Length) < lines[2].Length - 1)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            //剪枝1:对应被减数和减数位相减后的情况剪枝
            int max_line_LEN = max_line_len;

            for (int i = 0; i < max_line_LEN; i++)
            {
                char[] xc      = new char[3];
                int[]  xi      = new int[3];
                bool   do_this = true;
                for (int j = 0; j < 3; j++)
                {
                    xc[j] = get_from_line_end(j, i);
                    if (xc[j] < '0' || xc[j] > '9')
                    {
                        do_this = false;
                        break;
                    }
                    xi[j] = xc[j] - '0';
                }
                if (do_this)
                {
                    if (lines[2][0] != '-')
                    {
                        int tmpi = (xi[0] + 10 - xi[1]) % 10;
                        if (tmpi != xi[2] && tmpi - 1 != xi[2])
                        {
                            ret             = new SKSpecialDecimal(-2);
                            NodePointStatic = ret;
                            return(ret);
                        }
                    }
                    else
                    {
                        //A-B=-C  =>  A+C=B
                        int tmpi = (xi[0] + xi[2]) % 10;
                        if (tmpi != xi[1] && (tmpi + 1) % 10 != xi[1])
                        {
                            ret             = new SKSpecialDecimal(-2);
                            NodePointStatic = ret;
                            return(ret);
                        }
                    }
                }
            }
            //剪枝2:低位相减是否相同
            int min_last_len = -1;

            string[] last = new string[3];
            for (int i = 0; i < 3; i++)
            {
                last[i] = get_last_num(lines[i]);
                if (last[i].Length < min_last_len || min_last_len == -1)
                {
                    min_last_len = last[i].Length;
                }
            }
            if (min_last_len > 0)
            {
                SKSpecialDecimal j1 = new SKSpecialDecimal(last[0].Substring(last[0].Length - min_last_len));
                SKSpecialDecimal j2 = new SKSpecialDecimal(last[1].Substring(last[1].Length - min_last_len));
                SKSpecialDecimal j3 = new SKSpecialDecimal(last[2].Substring(last[2].Length - min_last_len));
                string           left = "", right = "";
                if (lines[2][0] != '-')
                {
                    left  = SKSpecialDecimal.abs(j2 + j3).to_string_only_integer();
                    right = last[0].Substring(last[0].Length - min_last_len);
                }
                else
                {
                    left  = SKSpecialDecimal.abs(j1 + j3).to_string_only_integer();
                    right = last[1].Substring(last[1].Length - min_last_len);
                }
                if (left.Length < min_last_len)
                {
                    string tmpstring = "";
                    for (int i = 0; i < min_last_len - left.Length; i++)
                    {
                        tmpstring += "0";
                    }
                    left = tmpstring + left;
                }
                left = left.Substring(left.Length - min_last_len);

                if (left != right)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
            }
            //TODO:剪枝3,不可能的算式
            string[] linesa = spilt_string; //A-B最大的结果比当前C最小的数还小
            string[] linesb = spilt_string; //A-B最小的结果比当前C最大的数还大
            linesa[1] = linesa[1].Substring(1);
            linesb[1] = linesb[1].Substring(1);
            for (int j = 0; j < linesa[0].Length; j++)
            {
                if (linesa[0][j] >= 'A' && linesa[0][j] <= 'J')
                {
                    linesa[0] = linesa[0].Replace(linesa[0][j], '9');
                    linesb[0] = linesb[0].Replace(linesb[0][j], '0');
                }
            }
            for (int j = 0; j < linesa[1].Length; j++)
            {
                if (linesa[1][j] >= 'A' && linesa[1][j] <= 'J')
                {
                    linesa[1] = linesa[1].Replace(linesa[1][j], '0');
                    linesb[1] = linesb[1].Replace(linesb[1][j], '9');
                }
            }
            for (int j = 0; j < linesa[2].Length; j++)
            {
                if (linesa[2][j] >= 'A' && linesa[2][j] <= 'J')
                {
                    if (lines[2][0] != '-')
                    {
                        linesa[2] = linesa[2].Replace(linesa[2][j], '0');
                        linesb[2] = linesb[2].Replace(linesb[2][j], '9');
                    }
                    else
                    {
                        linesa[2] = linesa[2].Replace(linesa[2][j], '9');
                        linesb[2] = linesb[2].Replace(linesb[2][j], '0');
                    }
                }
            }
            SKSpecialDecimal g1 = new SKSpecialDecimal(linesa[0]);
            SKSpecialDecimal g2 = new SKSpecialDecimal(linesa[1]);
            SKSpecialDecimal g3 = new SKSpecialDecimal(linesa[2]);
            SKSpecialDecimal h1 = new SKSpecialDecimal(linesb[0]);
            SKSpecialDecimal h2 = new SKSpecialDecimal(linesb[1]);
            SKSpecialDecimal h3 = new SKSpecialDecimal(linesb[2]);

            if ((g1 - g2).compare_to(g3) < 0 || (h1 - h2).compare_to(h3) > 0)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            //计算分值判断结果
            List <int> ava = available_nums();

            if (ava.Count == 0)
            {
                return(new SKSpecialDecimal(0));
            }
            int avg = (int)Math.Round((double)ava.Sum() / ava.Count);

            if (avg >= 10)
            {
                avg = 9;
            }
            else if (avg <= 0)
            {
                avg = 0;
            }
            string tmpb = equation_console;

            for (int i = 0; i < tmpb.Length; i++)
            {
                if (tmpb[i] >= 'A' && tmpb[i] <= 'J')
                {
                    tmpb = tmpb.Replace(tmpb[i], (char)(avg + '0'));
                }
            }
            string[] _lines = tmpb.Split(new char[1] {
                '_'
            });
            _lines[1] = _lines[1].Substring(1);
            SKSpecialDecimal a1 = new SKSpecialDecimal(_lines[0]);
            SKSpecialDecimal a2 = new SKSpecialDecimal(_lines[1]);
            SKSpecialDecimal a3 = new SKSpecialDecimal(_lines[2]);

            ret = SKSpecialDecimal.abs(a3 - (a1 - a2));
            ret = SKSpecialDecimal.abs(ret) + available_letters().Count;
            if (!ret.is_zero() && available_letters().Count == 0)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            NodePointStatic = ret;
            return(ret);
        }
Exemple #3
0
        private SKSpecialDecimal cal_node_point()
        {
            if (equation_console == "")
            {
                return(new SKSpecialDecimal());
            }
            if (NodePointStatic.compare_to(new SKSpecialDecimal(-1)) != 0)
            {
                return(NodePointStatic);
            }

            SKSpecialDecimal ret = new SKSpecialDecimal(0);

            //剪枝0:行数
            string[] lines = spilt_string;
            if (lines.Length < 5)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            int dif   = lines[0].Length - lines[1].Length + 1;
            int dif_p = (dif < 0) ? 0 : dif;

            if (lines.Length != 3 + lines[lines.Length - 1].Length * 2)//样例:768/9和768/14
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            //剪枝1:结果位数太多
            if (lines[lines.Length - 1].Length > dif_p + 1)
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            ////剪枝1.5:检查按行掉落
            //for (int i = 0; i < lines[lines.Length - 1].Length - 1; i++)
            //{
            //    if (lines[2 * i + 4][lines[2 * i + 4].Length - 1] != lines[0][lines[1].Length - 1 + i])
            //    {
            //        ret = new SKSpecialDecimal(-2);
            //        NodePointStatic = ret;
            //        return ret;
            //    }
            //}
            //剪枝2:乘法
            string be_div_last_num = get_last_num(lines[1]);

            if (be_div_last_num.Length > 0)
            {
                SKSpecialDecimal be_div_last_num_num = new SKSpecialDecimal(be_div_last_num);
                for (int i = 0; i < lines[lines.Length - 1].Length; i++)
                {
                    char c = lines[lines.Length - 1][i];
                    if (c >= '0' && c <= '9')
                    {
                        string           right_num    = get_last_num(lines[2 * i + 2]);
                        int              min_last_len = Math.Min(right_num.Length, be_div_last_num.Length);
                        SKSpecialDecimal left_num     = be_div_last_num_num * (int)(c - '0');
                        string           left         = left_num.to_string_only_integer();
                        if (left.Length < min_last_len)
                        {
                            string tmpstring = "";
                            for (int j = 0; j < min_last_len - left.Length; j++)
                            {
                                tmpstring += "0";
                            }
                            left = tmpstring + left;
                        }
                        left = left.Substring(left.Length - min_last_len);
                        string right = right_num.Substring(right_num.Length - min_last_len);
                        if (left != right)
                        {
                            ret             = new SKSpecialDecimal(-2);
                            NodePointStatic = ret;
                            return(ret);
                        }
                    }
                }
            }
            //TODO:剪枝3:检查减法

            //计算分值返回
            List <int> ava = available_nums();

            if (ava.Count == 0)
            {
                return(new SKSpecialDecimal(0));
            }
            int avg = (int)Math.Round((double)ava.Sum() / ava.Count);

            if (avg >= 10)
            {
                avg = 9;
            }
            else if (avg <= 0)
            {
                avg = 0;
            }
            string tmpb = equation_console;

            for (int i = 0; i < tmpb.Length; i++)
            {
                if (tmpb[i] >= 'A' && tmpb[i] <= 'J')
                {
                    tmpb = tmpb.Replace(tmpb[i], (char)(avg + '0'));
                }
            }
            string[] _lines = tmpb.Split(new char[1] {
                '_'
            });
            _lines[1] = _lines[1].Substring(1);
            //1:乘法差异
            SKSpecialDecimal be_div = new SKSpecialDecimal(_lines[1]);

            for (int i = 0; i < _lines[_lines.Length - 1].Length; i++)
            {
                ret += SKSpecialDecimal.abs(be_div * (_lines[_lines.Length - 1][i] - '0') - (new SKSpecialDecimal(_lines[2 * i + 2])));
            }
            //2:减法差异


            if (_lines[_lines.Length - 1].Length == 1)
            {
                //2.0:第一减法差异
                SKSpecialDecimal b1, b2, b3;
                b2 = new SKSpecialDecimal(_lines[2]);
                b3 = new SKSpecialDecimal(_lines[3].Substring(0, _lines[3].Length));
                int fetch = _lines[0].Length - _lines[_lines.Length - 1].Length + 1;
                b1   = new SKSpecialDecimal(_lines[0].Substring(0, fetch));
                ret += SKSpecialDecimal.abs((b1 - b2) - b3);
            }
            else
            {
                //2.0:第一减法差异
                SKSpecialDecimal b1, b2, b3;
                b2 = new SKSpecialDecimal(_lines[2]);
                if (_lines[3].Length == 1)
                {
                    b3 = new SKSpecialDecimal(0);
                }
                else
                {
                    b3 = new SKSpecialDecimal(_lines[3].Substring(0, _lines[3].Length - 1));
                }
                int fetch = _lines[0].Length - _lines[_lines.Length - 1].Length + 1;
                b1   = new SKSpecialDecimal(_lines[0].Substring(0, fetch));
                ret += SKSpecialDecimal.abs((b1 - b2) - b3);
                //2.1:最后减法差异
                SKSpecialDecimal c1, c2, c3;
                c1   = new SKSpecialDecimal(_lines[_lines.Length - 4]);
                c2   = new SKSpecialDecimal(_lines[_lines.Length - 3]);
                c3   = new SKSpecialDecimal(_lines[_lines.Length - 2]);
                ret += SKSpecialDecimal.abs((c1 - c2) - c3);
                //2.2:其他减法差异
                for (int i = 0; i < (lines.Length - 3) / 2 - 2; i++)
                {
                    SKSpecialDecimal a1 = new SKSpecialDecimal(_lines[3 + i * 2]);
                    SKSpecialDecimal a2 = new SKSpecialDecimal(_lines[4 + i * 2]);
                    SKSpecialDecimal a3;
                    if (_lines[5 + i * 2].Length == 1)
                    {
                        a3 = new SKSpecialDecimal(0);
                    }
                    else
                    {
                        a3 = new SKSpecialDecimal(_lines[5 + i * 2].Substring(0, _lines[5 + 3 * i].Length - 1));
                    }
                    ret += SKSpecialDecimal.abs((a1 - a2) - a3);
                }
                ret = SKSpecialDecimal.abs(ret) + available_letters().Count;
                if (!ret.is_zero() && available_letters().Count == 0)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
                NodePointStatic = ret;
                return(ret);
            }
            return(ret);
        }
Exemple #4
0
        private SKSpecialDecimal cal_node_point()
        {
            if (equation_console == "")
            {
                return(new SKSpecialDecimal());
            }
            if (NodePointStatic.compare_to(new SKSpecialDecimal(-1)) != 0)
            {
                return(NodePointStatic);
            }

            SKSpecialDecimal ret = new SKSpecialDecimal();

            //剪枝0,行数与乘数不对应
            string[] lines = spilt_string;
            if (lines[1].Length < 2 || (lines[1].Length == 2 && lines.Length != 3) || (lines[1].Length > 2 && lines[1].Length - 1 != lines.Length - 3))
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            //剪枝0.5:不可能的乘法-结果位数太多
            if (lines[lines.Length - 1].Length > (lines[0].Length + lines[1].Length))
            {
                ret             = new SKSpecialDecimal(-2);
                NodePointStatic = ret;
                return(ret);
            }
            //分类-按单位数乘法和多位数乘法
            if (lines[1].Length == 2)
            {
                //剪枝1:低位乘法
                if (lines[1][1] >= '0' && lines[1][1] <= '9')
                {
                    int    min_last_len = -1;
                    string lastup, lastdown;
                    lastup       = get_last_num(lines[0]);
                    lastdown     = get_last_num(lines[2]);
                    min_last_len = (lastup.Length >= lastdown.Length) ? lastdown.Length : lastup.Length;
                    if (min_last_len > 0)
                    {
                        SKSpecialDecimal mup = new SKSpecialDecimal(lines[0].Substring(lines[0].Length - min_last_len));
                        //SKSpecialDecimal mdown = new SKSpecialDecimal(lines[2].Substring(lines[2].Length - min_last_len));
                        string left = (mup * new SKSpecialDecimal(lines[1][1].ToString())).to_string_only_integer();
                        if (left.Length < min_last_len)
                        {
                            string tmpstring = "";
                            for (int i = 0; i < min_last_len - left.Length; i++)
                            {
                                tmpstring += "0";
                            }
                            left = tmpstring + left;
                        }
                        left = left.Substring(left.Length - min_last_len);
                        string right = lines[2].Substring(lines[2].Length - min_last_len);
                        if (left != right)
                        {
                            ret             = new SKSpecialDecimal(-2);
                            NodePointStatic = ret;
                            return(ret);
                        }
                    }
                }
                //剪枝2:不可能乘法(结果太大或太小)
                string[] linesa = spilt_string; //A*B最大的结果比当前C最小的数还小
                string[] linesb = spilt_string; //A*B最小的结果比当前C最大的数还大
                linesa[1] = linesa[1].Substring(1);
                linesb[1] = linesb[1].Substring(1);
                for (int j = 0; j < linesa[0].Length; j++)
                {
                    if (linesa[0][j] >= 'A' && linesa[0][j] <= 'J')
                    {
                        linesa[0] = linesa[0].Replace(linesa[0][j], '9');
                        linesb[0] = linesb[0].Replace(linesb[0][j], '0');
                    }
                }
                if (linesa[1][0] >= 'A' && linesa[1][0] <= 'J')
                {
                    linesa[1] = "9";
                    linesb[1] = "0";//TODO:这个有必要检查么?
                }
                for (int j = 0; j < linesa[2].Length; j++)
                {
                    if (linesa[2][j] >= 'A' && linesa[2][j] <= 'J')
                    {
                        linesa[2] = linesa[2].Replace(linesa[2][j], '0');
                        linesb[2] = linesb[2].Replace(linesb[2][j], '9');
                    }
                }
                SKSpecialDecimal g1 = new SKSpecialDecimal(linesa[0]);
                SKSpecialDecimal g2 = new SKSpecialDecimal(linesa[1]);
                SKSpecialDecimal g3 = new SKSpecialDecimal(linesa[2]);
                SKSpecialDecimal h1 = new SKSpecialDecimal(linesb[0]);
                SKSpecialDecimal h2 = new SKSpecialDecimal(linesb[1]);
                SKSpecialDecimal h3 = new SKSpecialDecimal(linesb[2]);
                if ((g1 * g2).compare_to(g3) < 0 || (h1 * h2).compare_to(h3) > 0)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
                //计算分值返回
                List <int> ava = available_nums();
                if (ava.Count == 0)
                {
                    return(new SKSpecialDecimal(0));
                }
                int avg = (int)Math.Round((double)ava.Sum() / ava.Count);
                if (avg >= 10)
                {
                    avg = 9;
                }
                else if (avg <= 0)
                {
                    avg = 0;
                }
                string tmpb = equation_console;
                for (int i = 0; i < tmpb.Length; i++)
                {
                    if (tmpb[i] >= 'A' && tmpb[i] <= 'J')
                    {
                        tmpb = tmpb.Replace(tmpb[i], (char)(avg + '0'));
                    }
                }
                string[] _lines = tmpb.Split(new char[1] {
                    '_'
                });
                _lines[1] = _lines[1].Substring(1);
                SKSpecialDecimal a1 = new SKSpecialDecimal(_lines[0]);
                SKSpecialDecimal a2 = new SKSpecialDecimal(_lines[1]);
                SKSpecialDecimal a3 = new SKSpecialDecimal(_lines[2]);
                ret = SKSpecialDecimal.abs(a3 - (a1 * a2));
                ret = SKSpecialDecimal.abs(ret) + available_letters().Count;
                if (!ret.is_zero() && available_letters().Count == 0)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
                NodePointStatic = ret;
                return(ret);
            }
            else
            {
                //多位数乘法!
                //按位执行单位数剪枝
                string up = lines[0];
                ret.reset(0);
                int lines_len = lines[1].Length - 1;//乘法中间行数
                for (int i = 1; i < lines[1].Length; i++)
                {
                    string mid = "_*" + lines[1][i];
                    //down是从下往上数第i行
                    string      down         = "_" + lines[lines.Length - i - 1];
                    string      temp_console = up + mid + down;
                    MulEquation tmp_eq       = new MulEquation(temp_console);
                    if (tmp_eq.node_point.compare_to(0) < 0)
                    {
                        ret             = new SKSpecialDecimal(-2);
                        NodePointStatic = ret;
                        return(ret);
                    }
                    ret = ret + tmp_eq.node_point;
                }
                //加法剪枝
                //目前只写一个低位剪枝先
                int      min_last_len = -1;
                string[] last         = new string[lines_len + 1];
                for (int i = 0; i < lines_len + 1; i++)
                {
                    last[i] = get_last_num(lines[i + 2]);
                    //乘法中间层补零
                    if (i < lines_len)
                    {
                        for (int j = 0; j < i; j++)
                        {
                            last[i] = last[i] + '0';
                        }
                    }
                    if (last[i].Length < min_last_len || min_last_len == -1)
                    {
                        min_last_len = last[i].Length;
                    }
                }
                if (min_last_len > 0)
                {
                    SKSpecialDecimal tmp_add  = new SKSpecialDecimal();
                    SKSpecialDecimal left_sum = new SKSpecialDecimal(0);
                    for (int i = 0; i < lines_len; i++)
                    {
                        tmp_add.reset(last[i].Substring(last[i].Length - min_last_len));
                        left_sum = left_sum + tmp_add;
                    }
                    string left = left_sum.to_string_only_integer();
                    if (left.Length < min_last_len)
                    {
                        string tmpstring = "";
                        for (int i = 0; i < min_last_len - left.Length; i++)
                        {
                            tmpstring += "0";
                        }
                        left = tmpstring + left;
                    }
                    left = left.Substring(left.Length - min_last_len);
                    string right = last[lines_len].Substring(last[lines_len].Length - min_last_len);
                    if (left != right)
                    {
                        ret             = new SKSpecialDecimal(-2);
                        NodePointStatic = ret;
                        return(ret);
                    }
                }
                //计算分值返回
                List <int> ava = available_nums();
                if (ava.Count == 0)
                {
                    return(new SKSpecialDecimal(0));
                }
                int avg = (int)Math.Round((double)ava.Sum() / ava.Count);
                if (avg >= 10)
                {
                    avg = 9;
                }
                else if (avg <= 0)
                {
                    avg = 0;
                }
                string tmpb = equation_console;
                for (int i = 0; i < tmpb.Length; i++)
                {
                    if (tmpb[i] >= 'A' && tmpb[i] <= 'J')
                    {
                        tmpb = tmpb.Replace(tmpb[i], (char)(avg + '0'));
                    }
                }
                string[] _lines = tmpb.Split(new char[1] {
                    '_'
                });
                _lines[1] = _lines[1].Substring(1);
                //只计算加法分的影响
                SKSpecialDecimal _tmp     = new SKSpecialDecimal();
                SKSpecialDecimal _tmp_sum = new SKSpecialDecimal(0);
                for (int i = 2; i < _lines.Length - 1; i++)
                {
                    _tmp.reset(_lines[i]);
                    _tmp.mul_10(i - 2);
                    _tmp_sum = _tmp_sum + _tmp;
                }
                SKSpecialDecimal _tmp_right_sum = new SKSpecialDecimal(_lines[_lines.Length - 1]);
                ret = ret + SKSpecialDecimal.abs(_tmp_right_sum - _tmp_sum);
                ret = SKSpecialDecimal.abs(ret) + available_letters().Count;
                if (!ret.is_zero() && available_letters().Count == 0)
                {
                    ret             = new SKSpecialDecimal(-2);
                    NodePointStatic = ret;
                    return(ret);
                }
                NodePointStatic = ret;
                return(ret);
            }
            return(ret);
        }