private void Button_Click(object sender, RoutedEventArgs e) { if (ch) { right1.Stop(); rt.Stop(); } else { wrong1.Stop(); wr.Stop(); } //count++; //if (count <= 6) //{ // Storyboard1.Begin(); //} //else //{ // Storyboard2.Begin(); //} Storyboard1_1.Begin(); Random rnd = new Random(); int t, i, j; Random rnd_sz = new Random(); size = rnd_sz.Next(4, 7); numb = new int[size]; numb_2 = new int[size]; int[] accum = new int[size]; count_comm = 0; for (t = 0; t < numb.Length; t++) { numb[t] = rnd.Next(0, 10); numb_2[t] = rnd.Next(0, 10); } num_f = numb.Distinct().ToArray(); num_f_2 = numb_2.Distinct().ToArray(); for (i = 0; i < num_f.Length; i++) { if (num_f_2.Contains(num_f[i])) { count_comm++; } } int count_index = rnd.Next(0, numb.Length); counter = 0; for (t = 0; t < numb.Length; t++) { if (numb[t] == numb[count_index]) { counter++; } } String sh = ""; String sh_2 = ""; String counter_str = counter.ToString(); if (corr_count > 5) { lvl2.IsEnabled = true; lvl2_unl.Text = "CONGRATURATIONS!!!!!\r\n\r\nLEVEL 3 UNLOCKED"; } for (t = 0; t < numb.Length; t++) { sh = sh + numb[t].ToString(); sh_2 = sh_2 + numb_2[t].ToString(); } String How_many = "How many distinct numbers were common in the two numbers you just saw ?"; int nu; double left, right; left = Math.Pow(10, (count - 1)); right = Math.Pow(10, count); int left_int, right_int; if (count <= 9) { left_int = Convert.ToInt32(left); right_int = Convert.ToInt32(right); nu = rnd.Next(left_int, right_int); } else { nu = rnd.Next(Convert.ToInt32(Math.Pow(10, 8)), Convert.ToInt32(Math.Pow(10, 9))); } String s = nu.ToString(); textBlock1.Text = sh; number2.Text = sh_2; textBox1.Text = ""; How.Text = How_many; //while(test.Opacity != 0) //{ //} //textBox1.Focus(); //while (true) //{ // if (test.Opacity == 0) // { // break; // } //} //textBox1.Focus(); //if (Storyboard1.GetCurrentTime()=) //{ // textBox1.Focus(); //} textBox1.Focus(); disp_num.IsEnabled = false; disp_num.Opacity = 0; check_score.Opacity = 100; check_score.IsEnabled = true; }
private void Button_Click(object sender, RoutedEventArgs e) { if (ch) { right1.Stop(); rt.Stop(); } else { wrong1.Stop(); wr.Stop(); } //count++; //if (count <= 6) //{ // Storyboard1.Begin(); //} //else //{ // Storyboard2.Begin(); //} Storyboard1_1.Begin(); Random rnd = new Random(); int t; Random rnd_sz = new Random(); size = rnd_sz.Next(14, 21); numb = new int[size]; for (t = 0; t < numb.Length; t++) { numb[t] = rnd.Next(0, 10); } int count_index = rnd.Next(0, numb.Length); counter = 0; for (t = 0; t < numb.Length; t++) { if (numb[t] == numb[count_index]) { counter++; } } String sh = ""; String counter_str = counter.ToString(); if (corr_count > 5) { lvl2.IsEnabled = true; lvl2_unl.Text = "CONGRATURATIONS!!!!!\r\n\r\nLEVEL 2 UNLOCKED"; } for (t = 0; t < numb.Length; t++) { sh = sh + numb[t].ToString(); } String How_many = "How many times did " + numb[count_index].ToString() + " occur?"; int nu; double left, right; left = Math.Pow(10, (count - 1)); right = Math.Pow(10, count); int left_int, right_int; if (count <= 9) { left_int = Convert.ToInt32(left); right_int = Convert.ToInt32(right); nu = rnd.Next(left_int, right_int); } else { nu = rnd.Next(Convert.ToInt32(Math.Pow(10, 8)), Convert.ToInt32(Math.Pow(10, 9))); } String s = nu.ToString(); textBlock1.Text = sh; textBox1.Text = ""; How.Text = How_many; //while(test.Opacity != 0) //{ //} //textBox1.Focus(); //while (true) //{ // if (test.Opacity == 0) // { // break; // } //} //textBox1.Focus(); //if (Storyboard1.GetCurrentTime()=) //{ // textBox1.Focus(); //} textBox1.Focus(); disp_num.IsEnabled = false; disp_num.Opacity = 0; check_score.Opacity = 100; check_score.IsEnabled = true; }