コード例 #1
0
ファイル: TwoColorBall.cs プロジェクト: windygu/asxinyunet
 /// <summary>
 /// 获取杀号类型规则后形成的列表:适用于不是用预处理直接获取数据的情况
 /// </summary>
 /// <param name="ruleList">杀号规则列表</param>
 public static LotTickData[] GetInitiaDataByNotUserPrepareData(RuleInfo[] ruleList)
 {
     List<int> RedBall = new List<int>(33);
     List<int> BlueBall = new List<int>(16);
     //初始化            
     for (int i = 0; i <33 ; i++) RedBall.Add (i +1);
     for (int i = 0; i <16 ; i++) BlueBall.Add (i +1);
     for (int i = 0; i < ruleList.Length ; i++)
     {
         LotTickData[] curData = new LotTickData[ruleList[i].CalcuteRows + ruleList[i].NeedRows];
         if (ruleList[i].IndexSelector.ToString().Contains("红")) //杀红
             RedBall =RedBall.Except(ruleList[i].IndexSelector.DeleteNumbers(curData)).ToList ();
         else                                                     //杀篮
             BlueBall =BlueBall.Except(ruleList[i].IndexSelector.DeleteNumbers(curData)).ToList ();
     }
     //对红和蓝进行组合、迭代获取所有组合序列,并对每个序列进行判断         
     int[][] Red = new Combination(RedBall.Count , 6).Rows.Select
         (n => Combination.Permute(n, RedBall ).ToArray()).ToArray();
     LotTickData[] res = new LotTickData[Red.GetLength(0) * BlueBall.Count];//总数
     int count = 0;
     for (int i = 0; i < Red.GetLength(0); i++)
     {
         for (int j = 0; j < BlueBall.Count ; j++)
         {
             res[count] = new LotTickData();//红蓝组合
             res[count].NormalData = Red[i];
             res[count++].SpecialData = BlueBall[j];
         }
     }
     return res ;
 }