public static string HandInput(string str, ArrayList arrRound, int[,] miniRedBall, int[,] redBall, hangzhou hz) { string[] strNew = str.Trim().Split(' '); int[] input = new int[strNew.Length]; int sum = 0; int nearRepeat = 0; int prime = 0; int two = 0; int leftRight = 0; int upup = 0; for (int i = 0; i < strNew.Length; i++) { input[i] = int.Parse(strNew[i]); sum += input[i]; upup += MyTest.FindUpNumber(0, input[i] - 1, arrRound.Count - 1, redBall); two += MyTest.ISTwo(input[i]); prime += MyTest.ISPrime(input[i]); nearRepeat += MyTest.ISNearRepeat(redBall, input[i], 1); } leftRight = input[strNew.Length - 1] - input[0]; string returnStr = "sum=" + sum.ToString() + "_" + hz.Sum.ToString() + "|leftRight=" + leftRight.ToString() + "_" + hz.LeftRight.ToString() + "|upup=" + upup.ToString() + "_" + hz.UpUp.ToString() + "|two=" + two.ToString() + "_" + hz.Two.ToString() + "|prime=" + prime.ToString() + "_" + hz.Prime.ToString() + "|nearRepeat=" + nearRepeat.ToString() + "_" + hz.NearRepeat.ToString(); return(returnStr); }
protected void Page_Load(object sender, EventArgs e) { _DT = CreateTable(); GameOver = 1;//模拟结果为1,计算结果为2, int maxCount = 10000; MyTest.ReadFile(_ArrRound, _ArrGoal, _RedBall, _MiniRedBall, _OneBall, _TwoBall, maxCount, "big"); if (GameOver == 2) { //_HangZhou.Data = 121; //_HangZhou.Data1 = 0; //_HangZhou.Data2 = 4;//down //_HangZhou.Data3 = 15; //_HangZhou.Data33 = ""; //_HangZhou.Two = -1; //_HangZhou.Prime = 1; //_HangZhou.NearRepeat = 3; //_HangZhou.Mini0 = 5;//up //_HangZhou.Mini1 = 5;//down //_HangZhou.Mini2 = 35;//up //_HangZhou.Mini3 = 23;//up //_HangZhou.Mini4 = 20;//up //_HangZhou.Mini5 = -1;//up int a1 = _MiniRedBall[0, 1]; int a2 = _MiniRedBall[1, 1]; int a3 = _MiniRedBall[2, 1]; int a4 = _MiniRedBall[3, 1]; int a5 = _MiniRedBall[4, 1]; int a21 = _MiniRedBall[0, 2]; int a22 = _MiniRedBall[1, 2]; int a23 = _MiniRedBall[2, 2]; int a24 = _MiniRedBall[3, 2]; int a25 = _MiniRedBall[4, 2]; //int a6 = _TwoBall[1]; int sum = 0;//= a1 + a2 + a3 + a4 + a5; int upup = 0; for (int j = 0; j < 5; j++) { sum += _MiniRedBall[j, 1]; upup += MyTest.FindUpNumber(1, _MiniRedBall[j, 1] - 1, _ArrRound.Count - 1, _RedBall); } int count = 0; if (_HangZhou.Data33.Contains(a1.ToString("00"))) { count++; } if (_HangZhou.Data33.Contains(a2.ToString("00"))) { count++; } if (_HangZhou.Data33.Contains(a3.ToString("00"))) { count++; } if (_HangZhou.Data33.Contains(a4.ToString("00"))) { count++; } if (_HangZhou.Data33.Contains(a5.ToString("00"))) { count++; } //_Print = true; int isPrime = MyTest.ISPrime(a1) + MyTest.ISPrime(a2) + MyTest.ISPrime(a3) + MyTest.ISPrime(a4) + MyTest.ISPrime(a5); int isTwo = MyTest.ISTwo(a1) + MyTest.ISTwo(a2) + MyTest.ISTwo(a3) + MyTest.ISTwo(a4) + MyTest.ISTwo(a5); int isNearRepeat = MyTest.ISNearRepeat(_RedBall, a1, GameOver) + MyTest.ISNearRepeat(_RedBall, a2, GameOver) + MyTest.ISNearRepeat(_RedBall, a3, GameOver) + MyTest.ISNearRepeat(_RedBall, a4, GameOver) + MyTest.ISNearRepeat(_RedBall, a5, GameOver); MyGoal.InnerHtml += NewNumber.DisplayStr("00--" + _ArrRound[1].ToString() + " --#" + sum.ToString() + "_" + _HangZhou.Sum + "|" + (a5 - a1).ToString() + "_" + _HangZhou.LeftRight + "|" + _OneBall[1].ToString() + "_" + _HangZhou.BlueBall + "_" + _OneBall[2].ToString() + "|" + upup.ToString() + "_" + _HangZhou.UpUp + "|" + count.ToString() + "|" + a1.ToString() + "_" + _HangZhou.Mini0 + "_" + a21.ToString() + "|" + a2.ToString() + "_" + _HangZhou.Mini1 + "_" + a22.ToString() + "|" + a3.ToString() + "_" + _HangZhou.Mini2 + "_" + a23.ToString() + "|" + a4.ToString() + "_" + _HangZhou.Mini3 + "_" + a24.ToString() + "|" + a5.ToString() + "_" + _HangZhou.Mini4 + "_" + a25.ToString() + "|" + _TwoBall[1].ToString() + "_" + _HangZhou.Mini5 + "_" + _TwoBall[2].ToString() + "|" + isTwo.ToString() + "_" + _HangZhou.Two + "|" + isPrime.ToString() + "_" + _HangZhou.Prime + "|" + isNearRepeat.ToString() + "_" + _HangZhou.NearRepeat, "green"); } if (GameOver == 1) { //_DT = CreateTable(); string dataBase = ""; //string dataBase = "Test"; //int maxCount = 1000; //string dataBase = "TestNew"; //_Data = true; //Combination(_Data); #region ForSpssModeler dataBase = "TestNew"; _Data = false; //_Print = true; CreateSpssModelerData(_ArrRound, _MiniRedBall, _RedBall, _OneBall, _TwoBall); #endregion #region TwoNearRepeat //777788 dataBase = "TestNew"; _Data = true; //_Print = true; TwoNearRepeat(_ArrRound, _MiniRedBall, _RedBall); #endregion if (_Data) { System.Data.SqlClient.SqlBulkCopy bcp = new System.Data.SqlClient.SqlBulkCopy("Data Source = .; Initial Catalog = " + dataBase + "; User Id = sa; Password = suyu57501;"); bcp.DestinationTableName = "dbo.TestOutput"; bcp.WriteToServer(_DT); } } }
private void CreateSpssModelerData(ArrayList arrRound, int[,] miniRedBall, int[,] redBall, int[] oneBall, int[] twoBall) { int[] sum = new int[arrRound.Count]; int[] leftRight = new int[arrRound.Count]; int[] upup = new int[arrRound.Count]; int[] mini0 = new int[arrRound.Count]; int[] mini1 = new int[arrRound.Count]; int[] mini2 = new int[arrRound.Count]; int[] mini3 = new int[arrRound.Count]; int[] mini4 = new int[arrRound.Count]; int[] mini5 = new int[arrRound.Count]; int[] two = new int[arrRound.Count]; int[] prime = new int[arrRound.Count]; int[] nearRepeat = new int[arrRound.Count]; for (int i = 1; i < arrRound.Count; i++) { MyGoal.InnerHtml += NewNumber.DisplayStr(arrRound[i].ToString() + " || ", "brown"); for (int j = 0; j < 5; j++) { sum[i] += miniRedBall[j, i]; MyGoal.InnerHtml += NewNumber.DisplayStr(miniRedBall[j, i].ToString("00") + " ", "red"); upup[i] += MyTest.FindUpNumber(i, miniRedBall[j, i] - 1, arrRound.Count - 1, redBall); two[i] += MyTest.ISTwo(miniRedBall[j, i]); prime[i] += MyTest.ISPrime(miniRedBall[j, i]); nearRepeat[i] += MyTest.ISNearRepeat(redBall, miniRedBall[j, i], i + 1); } leftRight[i] = miniRedBall[4, i] - miniRedBall[0, i]; MyGoal.InnerHtml += NewNumber.DisplayStr("--" + sum[i] + " || " + leftRight[i], "blue"); MyGoal.InnerHtml += NewNumber.DisplayBR(); mini0[i] = miniRedBall[0, i]; mini1[i] = miniRedBall[1, i]; mini2[i] = miniRedBall[2, i]; mini3[i] = miniRedBall[3, i]; mini4[i] = miniRedBall[4, i]; mini5[i] = twoBall[i]; } int select = 40; string strPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; FileStream fs = new FileStream(strPath + "\\spss\\data33\\33.txt", FileMode.Create); StreamWriter sw = new StreamWriter(fs); for (int i = 0; i < 35; i++) { int j = 0; string str = ""; while (j <= arrRound.Count - 1) { int ii = MyTest.FindUpNumber(j, i, arrRound.Count - 1, redBall); j += ii + 1; str += ii.ToString() + " "; } if (i % 2 == 0) { SpssToFile((i + 1).ToString(), select, str.Substring(0, str.Length - 1), "blue", sw); } else { SpssToFile((i + 1).ToString(), select, str.Substring(0, str.Length - 1), "green", sw); } } //清空缓冲区 sw.Flush(); //关闭流 sw.Close(); fs.Close(); select = 20; DisplaySpss(arrRound, select, mini0, "mini\\miniNew0.txt"); DisplaySpss(arrRound, select, mini1, "mini\\miniNew1.txt"); DisplaySpss(arrRound, select, mini2, "mini\\miniNew2.txt"); DisplaySpss(arrRound, select, mini3, "mini\\miniNEw3.txt"); DisplaySpss(arrRound, select, mini4, "mini\\miniNew4.txt"); DisplaySpss(arrRound, select, mini5, "mini\\miniNew5.txt"); DisplaySpss(arrRound, select, sum, "data0123\\dataNew.txt"); DisplaySpss(arrRound, select, leftRight, "data0123\\dataNew1.txt"); DisplaySpss(arrRound, select, oneBall, "data0123\\dataNew2.txt"); DisplaySpss(arrRound, select, upup, "data0123\\dataNew3.txt"); DisplaySpss(arrRound, select, two, "data0123\\two.txt"); DisplaySpss(arrRound, select, prime, "data0123\\prime.txt"); DisplaySpss(arrRound, select, nearRepeat, "data0123\\nearRepeat.txt"); }