Ejemplo n.º 1
0
        public override bool isMatch(string code, string currCode)
        {
            int    N        = code.Split(',').Length;
            string opencode = CombinGenerator.ResortNumString(currCode, ",");

            if (N <= SelNums)
            {
                CombinClass occ = new CombinClass(opencode, N);
                return(occ.Contains(code));
            }
            else
            {
                return(new CombinClass(code, SelNums).Contains(opencode));
            }
        }
Ejemplo n.º 2
0
        bool Match(ExpectData <TimeSerialData> data, out int MatchCnt)
        {
            MatchCnt = 0;
            string[] strOrgArr = data.OpenCode.Split(',');
            string   strRes    = CombinGenerator.ResortNumString(data.OpenCode, ",");

            foreach (ChanceItem ci in this.SubItems)
            {
                CombinClass container = null;
                string[]    strCiArr  = null;
                if (ci.betChipCnt <= SelectNums)
                {
                    strCiArr = new string[ci.betChipCnt];
                    Array.Copy(strOrgArr, strCiArr, ci.betChipCnt);
                }
                switch (ci.betType)
                {
                case CombinBetType.Permut:
                {
                    if (string.Join(",", strCiArr) == ci.betCode)        //未排序的数组和投注串完全相等
                    {
                        if (this.PermutTypebaseodds.ContainsKey(ci.betChipCnt - 1))
                        {
                            MatchCnt += PermutTypebaseodds[ci.betChipCnt - 1];
                            //break;
                        }
                        else        //找不到,返回基本倍数
                        {
                            MatchCnt += 2;
                        }
                    }

                    break;
                }

                case CombinBetType.Combin:
                {
                    string[] strSArr = CombinGenerator.ResortNumString(strCiArr);                      // 获取前N位排序好的中奖号码
                    if (string.Join(",", strSArr) == CombinGenerator.ResortNumString(ci.betCode, ",")) //如果排序好的前N位中奖串等于重排后的投注串,命中
                    {
                        if (this.CombinTypeChipsBaseOdds.ContainsKey(ci.betChipCnt - 1))
                        {
                            MatchCnt += CombinTypeChipsBaseOdds[ci.betChipCnt - 1];
                            //break;
                        }
                        else        //找不到,返回基本倍数
                        {
                            MatchCnt += 2;
                        }
                    }
                    break;
                }

                case CombinBetType.All:
                default:
                {
                    int tn = ci.betChipCnt + 1;                              //一定要加1,是标志基础
                    if (ci.betChipCnt > SelectNums)                          //如果大于选择码
                    {
                        container = new CombinClass(ci.betCode, SelectNums); //找出N码选出数目的所有组合
                        if (container.Contains(strRes))                      //命中
                        {
                            if (this.AllTypeChipsBaseOdds.ContainsKey(tn))
                            {
                                MatchCnt += AllTypeChipsBaseOdds[tn];
                                //break;
                            }
                            else        //找不到,返回基本倍数
                            {
                                MatchCnt += 2;
                            }
                        }
                    }
                    else
                    {
                        container = new CombinClass(strRes, ci.betChipCnt);        //中奖结果的C(S,N)组合
                        if (container.Contains(ci.betCode))
                        {
                            if (this.AllTypeChipsBaseOdds.ContainsKey(tn))
                            {
                                MatchCnt += AllTypeChipsBaseOdds[tn];
                                //break;
                            }
                            else        //找不到,返回基本倍数
                            {
                                MatchCnt += 2;
                            }
                        }
                    }
                    break;
                }
                }
                if (ci.betChipCnt >= SelectNums && MatchCnt > 0)//只要有一个子长机会命中,就不再检查其他子机会
                {
                    break;
                }
            }
            if (MatchCnt > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public override bool Matched(ExpectList <TimeSerialData> el, out int MatchCnt, bool getRev)
        {
            //ExpectData data = el.LastData;
            if (ChanceCode == null)//停止
            {
                MatchCnt = 0;
                return(true);
            }
            string[] strArr = ChanceCode.Split('+');
            MatchCnt = 0;
            int begid = -1;   //默认为0,多期再去寻找起点

            if (el.Count > 1) //多期考虑
            {
                if (long.Parse(this.ExpectCode) < long.Parse(el.FirstData.Expect))
                {
                    Log("错误", "匹配是否需要关闭错误", "需要关闭的机会早于数据以前,无论是否中奖,立即关闭!");
                    return(true);
                }
                begid = el.IndexOf(this.ExpectCode);
                if (begid < 0)
                {
                    Log("错误", "匹配是否需要关闭错误", "需要关闭的机会不在数据中,无论是否中奖,立即关闭!");
                    return(true);
                }
            }
            //////ExpectData inputEd = el[begid];
            //////Log("计算服务", "获取到期号信息", string.Format("expect:{0};openCode:{1}",inputEd.Expect,inputEd.OpenCode));
            if (el.Count == 1)//只匹配一期
            {
                int ei = el.Count == 1?el.Count - 1:begid + 1;
                ExpectData <TimeSerialData> data = el[ei];
                return(Match(data, out MatchCnt));

                string[] strOrgArr = data.OpenCode.Split(',');
                string   strRes    = CombinGenerator.ResortNumString(data.OpenCode, ",");
                foreach (ChanceItem ci in this.SubItems)
                {
                    CombinClass container = null;
                    string[]    strCiArr  = null;
                    if (ci.betChipCnt <= SelectNums)
                    {
                        strCiArr = new string[ci.betChipCnt];
                        Array.Copy(strOrgArr, strCiArr, ci.betChipCnt);
                    }
                    switch (ci.betType)
                    {
                    case CombinBetType.Permut:
                    {
                        if (string.Join(",", strCiArr) == ci.betCode)       //未排序的数组和投注串完全相等
                        {
                            if (this.PermutTypebaseodds.ContainsKey(ci.betChipCnt - 1))
                            {
                                MatchCnt += PermutTypebaseodds[ci.betChipCnt - 1];
                                //break;
                            }
                            else        //找不到,返回基本倍数
                            {
                                MatchCnt += 2;
                            }
                        }

                        break;
                    }

                    case CombinBetType.Combin:
                    {
                        string[] strSArr = CombinGenerator.ResortNumString(strCiArr);                      // 获取前N位排序好的中奖号码
                        if (string.Join(",", strSArr) == CombinGenerator.ResortNumString(ci.betCode, ",")) //如果排序好的前N位中奖串等于重排后的投注串,命中
                        {
                            if (this.CombinTypeChipsBaseOdds.ContainsKey(ci.betChipCnt - 1))
                            {
                                MatchCnt += CombinTypeChipsBaseOdds[ci.betChipCnt - 1];
                                //break;
                            }
                            else        //找不到,返回基本倍数
                            {
                                MatchCnt += 2;
                            }
                        }
                        break;
                    }

                    case CombinBetType.All:
                    default:
                    {
                        int tn = ci.betChipCnt + 1;                              //一定要加1,是标志基础
                        if (ci.betChipCnt > SelectNums)                          //如果大于选择码
                        {
                            container = new CombinClass(ci.betCode, SelectNums); //找出N码选出数目的所有组合
                            if (container.Contains(strRes))                      //命中
                            {
                                if (this.AllTypeChipsBaseOdds.ContainsKey(tn))
                                {
                                    MatchCnt += AllTypeChipsBaseOdds[tn];
                                    //break;
                                }
                                else        //找不到,返回基本倍数
                                {
                                    MatchCnt += 2;
                                }
                            }
                        }
                        else
                        {
                            container = new CombinClass(strRes, ci.betChipCnt);        //中奖结果的C(S,N)组合
                            if (container.Contains(ci.betCode))
                            {
                                if (this.AllTypeChipsBaseOdds.ContainsKey(tn))
                                {
                                    MatchCnt += AllTypeChipsBaseOdds[tn];
                                    //break;
                                }
                                else        //找不到,返回基本倍数
                                {
                                    MatchCnt += 2;
                                }
                            }
                        }
                        break;
                    }
                    }
                    if (ci.betChipCnt >= SelectNums && MatchCnt > 0)//只要有一个子长机会命中,就不再检查其他子机会
                    {
                        break;
                    }
                }
            }
            else
            {
                for (int i = begid + 1; i < el.Count; i++)//中途任何一次匹配都干掉
                {
                    ExpectData <TimeSerialData> data = el[i];
                    bool suc = Match(data, out MatchCnt);
                    if (suc)
                    {
                        break;
                    }
                }
            }
            if (MatchCnt > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
        DataTable getCombMatchMetrix(int period, string strType, int N)
        {
            DataTable dt = new DataTable();

            if (orgData.Count < period)//数据长度必须要不小于期数
            {
                return(null);
            }
            List <string> combList = new List <string>();

            if (strType == "P")
            {
                return(null);
            }
            else//A,C
            {
                CombinClass allNcmb = CombinClass.CreateNumCombin(AllNums, N);//获得所有N个
                combList = allNcmb;
            }
            dt.Columns.Add("id", typeof(int));
            combList.ForEach(a => dt.Columns.Add(a, typeof(int)));
            ExpectList currList = new ExpectList();

            for (int i = orgData.Count - period; i < orgData.Count; i++)
            {
                ExpectData <TimeSerialData> ed = new ExpectData <TimeSerialData>();
                ed.OpenCode = orgData[i].OpenCode;
                ed.Expect   = orgData[i].Expect;

                currList.Add(ed);
            }

            for (int i = 0; i < currList.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr["id"] = i;
                string opencode = currList[i].OpenCode;
                opencode = CombinGenerator.ResortNumString(opencode, ",");
                CombinClass occ = null;
                if (N <= SelNums)
                {
                    occ = new CombinClass(opencode, N);
                    combList.ForEach(a => {
                        dr[a] = occ.Contains(a) ? 1 : 0;
                    });
                }
                else
                {
                    combList.ForEach(a =>
                    {
                        occ = new CombinClass(a, SelNums);
                        if (occ.Contains(opencode))
                        {
                            dr[a] = 1;
                        }
                        else
                        {
                            dr[a] = 0;
                        }
                    });
                }
                dt.Rows.Add(dr);
            }
            return(dt);
        }