📄 blueball.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace cpzh
{
class BlueBall
{
static ArrayList historyData; //历史中奖数据
static int[][][] ruleArray; //规则数组
static ArrayList filterResult; //过滤结果
public BlueBall()
{
historyData = new ArrayList();
ruleArray = new int[16][][];
filterResult = new ArrayList();
fillRule();
}
#region//规则数组
/// <summary>
/// //规则数组
/// </summary>
public int[][][] RuleArray
{
//get
//{
// return ruleArray;
//}
set
{
ruleArray = value;
}
}
#endregion
#region//过滤结果
/// <summary>
/// 过滤结果
/// </summary>
public ArrayList FilterResult
{
get
{
return filterResult;
}
//set
//{
// filterResult = value;
//}
}
#endregion
#region//根据上期中奖篮球号获得本期预测结果
/// <summary>
/// 获得本期篮球预测结果
/// </summary>
/// <param name="previouNo">上期篮球中奖号码</param>
/// <returns>成功返回预测本期的中奖结果集,失败返回空数组</returns>
public ArrayList GetFilterResult(int previouNo)
{
int n=4;
if (previouNo > 16 || previouNo <1)
{
return new ArrayList ();
}
//起始位置为1,而不是0,因为0位之上是上期号码
filterResult.Add(int.Parse(ruleArray[previouNo - 1][0][0].ToString()));
for(int i=1;i<n;i++)
{
filterResult.Add(int.Parse(ruleArray[previouNo - 1][i][0].ToString()));
filterResult.Add (int.Parse ( ruleArray[previouNo-1][0][i].ToString ()));
filterResult.Add(int.Parse(ruleArray[previouNo-1][i ][i ].ToString()));
}
//filterResult.Sort();
return filterResult;
}
#endregion
#region//填充规则数组
/// <summary>
/// 填充规则数组
/// </summary>
private void fillRule()
{
int[][] array1=new int[4][];
int[][] array2 = new int[4][];
int[][] array3 = new int[4][];
int[][] array4 = new int[4][];
int[][] array5 = new int[4][];
int[][] array6 = new int[4][];
int[][] array7 = new int[4][];
int[][] array8 = new int[4][];
int[][] array9 = new int[4][];
int[][] array10 = new int[4][];
int[][] array11 = new int[4][];
int[][] array12 = new int[4][];
int[][] array13 = new int[4][];
int[][] array14 = new int[4][];
int[][] array15 = new int[4][];
int[][] array16 = new int[4][];
array1[0] = new int[] { 1, 8, 12, 13 };
array1[1] = new int[] { 14, 11, 7, 2 };
array1[2] = new int[] { 15, 10, 6, 3 };
array1[3] = new int[] { 4, 5, 9, 16 };
array2[0] = new int[] { 2,7,11,14 };
array2[1] = new int[] { 13,12,8,1 };
array2[2] = new int[] { 16,9,5,4};
array2[3] = new int[] { 3,6,10,15};
array3[0] = new int[] { 3,6,10,15};
array3[1] = new int[] { 16,9,5,4};
array3[2] = new int[] { 13,12,8,1};
array3[3] = new int[] { 2,7,11,14};
array4[0] = new int[] { 4 ,5, 9, 16 };
array4[1] = new int[] { 15, 10, 6, 3 };
array4[2] = new int[] { 14 ,11, 7, 2 };
array4[3] = new int[] { 1 ,8 ,12, 13 };
array5[0] = new int[] { 5, 4, 16, 9 };
array5[1] = new int[] { 10 ,15, 3, 6 };
array5[2] = new int[] { 11 ,14, 2, 7};
array5[3] = new int[] { 8 ,1 ,13, 12 };
array6[0] = new int[] { 6, 3, 15, 10 };
array6[1] = new int[] { 9 ,16, 4, 5};
array6[2] = new int[] {12 ,13 ,1 ,8 };
array6[3] = new int[] { 7, 2, 14, 11};
array7[0] = new int[] { 7, 2, 14, 11 };
array7[1] = new int[] { 12, 13, 1, 8 };
array7[2] = new int[] { 9, 16, 4, 5 };
array7[3] = new int[] { 6, 3, 15, 10 };
array8[0] = new int[] { 8, 1, 13, 12 };
array8[1] = new int[] { 11, 14, 2, 7 };
array8[2] = new int[] { 10, 15, 3, 6};
array8[3] = new int[] { 5, 4, 16, 9};
array9[0] = new int[] { 9, 6, 7, 12 };
array9[1] = new int[] { 16, 3, 2, 13};
array9[2] = new int[] { 4, 15, 14, 1 };
array9[3] = new int[] { 5, 10 ,11, 8 };
array10[0] = new int[] { 10, 5, 8, 11 };
array10[1] = new int[] { 15 ,4, 1, 14 };
array10[2] = new int[] { 3 ,16, 13, 2 };
array10[3] = new int[] { 6, 9, 12, 7 };
array11[0] = new int[] { 11, 8, 5, 10 };
array11[1] = new int[] { 14 ,1, 4, 15 };
array11[2] = new int[] { 2 ,13, 16, 3};
array11[3] = new int[] { 7 ,12 ,9, 6 };
array12[0] = new int[] { 12, 7, 6, 9 };
array12[1] = new int[] { 13 ,2, 3, 16};
array12[2] = new int[] { 1 ,14, 15, 4};
array12[3] = new int[] { 8 ,11, 10, 5 };
array13[0] = new int[] { 13, 2, 3, 16 };
array13[1] = new int[] { 12 ,7 ,6, 9 };
array13[2] = new int[] { 8 ,11, 10 ,5 };
array13[3] = new int[] { 1 ,14, 15, 4 };
array14[0] = new int[] { 14, 1, 4, 15};
array14[1] = new int[] { 11, 8, 5, 10 };
array14[2] = new int[] { 7, 12, 9, 6};
array14[3] = new int[] { 2, 13, 16, 3 };
array15[0] = new int[] { 15, 4, 1, 14 };
array15[1] = new int[] { 10, 5, 8, 11 };
array15[2] = new int[] { 6, 9, 12, 7 };
array15[3] = new int[] { 3, 16, 13, 2 };
array16[0] = new int[] { 16, 3, 2, 13 };
array16[1] = new int[] { 9, 6, 7, 12 };
array16[2] = new int[] { 5, 10, 11, 8 };
array16[3] = new int[] { 4, 15, 14, 1 };
ruleArray[0]=array1;
ruleArray[1] = array2;
ruleArray[2] = array3;
ruleArray[3] = array4;
ruleArray[4] = array5;
ruleArray[5] = array6;
ruleArray[6] = array7;
ruleArray[7] = array8;
ruleArray[8] = array9;
ruleArray[9] = array10;
ruleArray[10] = array11;
ruleArray[11] = array12;
ruleArray[12] = array13;
ruleArray[13] = array14;
ruleArray[14] = array15;
ruleArray[15] = array16;
}
#endregion
#region//获得蓝球历史中奖分布图
/// <summary>
/// 获得蓝球历史中奖分布图
/// </summary>
/// <param name="blueArray">蓝球中奖数据ArrayList{期号,中奖号}</param>
/// <returns>返回蓝球历史中奖分布图ArrayList{id,期号,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,是否符合规律}</returns>
public static ArrayList GetStatResult(ArrayList blueArray)
{
int[] iSum; //中间结果数组
string[][] history; //中奖数据
string[] temp; //中间结果数组
ArrayList alTemp; //中间结果数组
ArrayList filterResult; //预测本期中奖号数组
ArrayList ResultArray; //生成的最终结果数组
int [] filterArray; //预测本期中奖号数组
int iAward; //中奖号码
int iCurAward; //当前期中奖号码
BlueBall blueBall = new BlueBall(); //蓝球对象
iAward =0;
iSum =new int[16];
alTemp = new ArrayList();
temp = new string[19];
history =new string [blueArray .Count ][];
filterResult =new ArrayList ();
ResultArray = new ArrayList();
//blueArray.Sort();
blueArray.CopyTo(history);
//初始化临时数组
for (int i = 0; i < iSum.Length; i++)
{
iSum[i] = 0;
}
//for (int i = history .Length -1; i >-1; i--)
//for (int i = 0; i <history.Length ; i++)
for (int i = history.Length - 1; i > -1; i--)
{
temp=new string [19];
temp[0]=i.ToString ();
temp[1] = history[i][0].ToString();
//统计加1操作16个数
for(int j=0;j<16;j++)
{
iSum[j] = iSum[j] + 1;
temp[j+2]=iSum[j].ToString();
}
//把中奖位置置零
iSum[int.Parse(history[i][1].ToString())-1] = 0;
temp[int.Parse(history[i][1].ToString())+1] = "-" + history[i][1].ToString();
//判断是否符合规律
temp[18] = "0";
if (i != history .Length-1 )
{
//上期中奖号
alTemp.Clear();
filterArray = new int[10];
iAward = int.Parse (history[i + 1][1].ToString());
iCurAward = int.Parse(history[i ][1].ToString());
alTemp = blueBall.GetFilterResult(iAward);
alTemp.CopyTo(filterArray);
//filterArray =
for (int k = 0; k < filterArray.Length; k++)
{
if (int.Parse(filterArray[k].ToString()) == iCurAward)
{
temp[18] = "1";
}
}
}
ResultArray.Add(temp);
}
return ResultArray;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -