Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Stop_It
- {
- class Program
- {
- static string title_init = "";
- static string dir = System.IO.Directory.GetCurrentDirectory();
- static string path = System.IO.Path.GetFullPath(dir);
- //static System.Threading.Thread Time_Thread = new System.Threading.Thread(Ticked);
- //static System.Timers.Timer time = new System.Timers.Timer();
- //delegate void ChangeTitleCallback(string title);
- static void Main(string[] args)
- {
- int store_color;
- //int fileno=0;
- int duration = 1000;
- //int count_change = 0;
- //int Forecolor_cycles = 0;
- /*bool[] is_Changed = new bool[3];
- is_Changed[0] = false;
- is_Changed[1] = false;
- is_Changed[2] = false;*/
- title_init = args.Length == 1 ? args[0] : "";
- ConsoleColor[] colors = new ConsoleColor[16];
- colors[0] = ConsoleColor.Black;
- colors[1] = ConsoleColor.Blue;
- colors[2] = ConsoleColor.Cyan;
- colors[3] = ConsoleColor.DarkBlue;
- colors[4] = ConsoleColor.DarkCyan;
- colors[5] = ConsoleColor.DarkGray;
- colors[6] = ConsoleColor.DarkGreen;
- colors[7] = ConsoleColor.DarkMagenta;
- colors[8] = ConsoleColor.DarkRed;
- colors[9] = ConsoleColor.DarkYellow;
- colors[10] = ConsoleColor.Gray;
- colors[11] = ConsoleColor.Green;
- colors[12] = ConsoleColor.Magenta;
- colors[13] = ConsoleColor.Red;
- colors[14] = ConsoleColor.White;
- colors[15] = ConsoleColor.Yellow;
- string[] filler = new string[Console.WindowWidth];
- for (int wi = 0; wi < Console.WindowWidth; wi++)
- {
- filler[wi] = "_";
- }
- Int32[,,] tones = new Int32[100, 100, 2];
- int s_index = tones.Length;
- System.Random gen = new System.Random();
- for (int z = 0; z < 2; z++)
- {
- for (int i = 0; i < (tones.Length / 200); i++)
- {
- for (int index = 0; index < (tones.Length / 200); index++)
- {
- tones[i, index, z] = gen.Next(37, 1037);
- }
- }
- }
- for (int z = 0; z < 2; z++)
- {
- for (int i = 0; i < (tones.Length / 200); i++)
- {
- for (int index = 0; index < (tones.Length / 200); index++)
- {
- if (z == 0 && tones[i, index, z] < tones[i, index, z + 1])
- {
- int temp_tone = tones[i, index, z];
- tones[i, index, z + 1] = tones[i, index, z];
- tones[i, index, z] = temp_tone;
- }
- }
- }
- }
- //time.Start();
- System.IO.MemoryStream store = new System.IO.MemoryStream();
- using (var ms = new System.IO.MemoryStream())
- {
- var wl = new System.IO.StreamWriter(ms);
- do
- {
- for (int z = 0; z < 2; z++)
- {
- int bc_index = 0;
- int c_index = 0;
- for (int last1 = tones.Length; last1 > 0; last1--)
- {
- int temp_i1 = last1 != 0 ? (last1 / 200) - 1 : 0;
- //fileno = temp_i1;
- for (int last = tones.Length; last > 0; last--)
- {
- int temp_i2 = last != 0 ? (last / 200) - 1 : 0;
- string filename1 = String.Format("tones{0}.txt", temp_i2);
- bc_index = bc_index < colors.Length ? bc_index : 0;
- c_index = c_index < colors.Length ? c_index : 0;
- bc_index += temp_i2 != 99 ? 1:0;
- //int bc_index = gen.Next(0,15);
- System.IO.StreamWriter tw = new System.IO.StreamWriter(store);
- Console.Clear();
- Console.BackgroundColor = colors[bc_index];//!= Console.BackgroundColor ? colors[bc_index] : colors[gen.Next(0, 15)];
- Console.Clear();
- Console.BackgroundColor = colors[bc_index];//!= Console.BackgroundColor ? colors[bc_index] : colors[gen.Next(0, 15)];
- //count_change += colors[c_index] == colors[bc_index] ? 1 : 0;
- c_index+= c_index<colors.Length ? 1:0;
- //int duration = gen.Next(25, 100);
- //Console.Beep(tones[temp_i1, temp_i2, z_i], duration);
- for (int hi = 0; hi < Console.WindowHeight; hi++)
- {
- store_color = c_index;
- System.Random gen1 = new System.Random();
- //int last_background = c_index;
- c_index = c_index <= colors.Length - 1 ? c_index : 0;
- int beep_length = gen1.Next(1, 20);
- if (beep_length % 2 != 0)
- {
- int last_b = beep_length;
- beep_length = gen1.Next(2, 20);
- beep_length = beep_length != last_b ? beep_length : 8;
- }
- /*while (colors[bc_index] == colors[c_index])
- {
- /*while (last_background == c_index)
- {
- int c = gen.Next(0, 15);
- c_index = c;
- Console.BackgroundColor = colors[c_index];
- Console.ForegroundColor = colors[c_index];
- count_change += 1;
- }
- c_index++;
- bc_index++;
- Console.BackgroundColor = colors[c_index];
- Console.ForegroundColor = colors[c_index];
- /*if (count_change != 0)
- {
- beep_length = gen1.Next(1, 8);
- Console.Beep(tones[temp_i1, temp_i2, z], duration / beep_length);
- }
- count_change++;
- Forecolor_cycles += count_change == 2 ? 1 : 0;
- if (count_change == 2) { if (!System.IO.File.Exists(path + @"\count.txt")) { System.IO.File.CreateText(path + @"\count.txt"); System.IO.StreamWriter sw = new System.IO.StreamWriter(path + @"\count.txt"); sw.WriteLine(Forecolor_cycles); bc_index++; sw.Dispose(); } System.IO.StreamWriter sw1 = new System.IO.StreamWriter(path + @"\count.txt"); sw1.WriteLine(Forecolor_cycles); bc_index++; sw1.Dispose(); }
- count_change = count_change == 16 ? 0 : count_change;*/
- Console.BackgroundColor = colors[c_index];
- Console.ForegroundColor = colors[c_index];
- bool changed2 = false;
- while (changed2 == false)
- {
- Console.BackgroundColor = Console.BackgroundColor != colors[bc_index] ? Console.BackgroundColor : colors[gen1.Next(0, 15)];
- if (Console.BackgroundColor == colors[bc_index])
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- changed2 = Console.BackgroundColor != colors[bc_index];
- }
- changed2 = Console.BackgroundColor != colors[bc_index];
- }
- for (int wi = 0; wi < Console.WindowWidth; wi++)
- {
- int z_i = gen.Next(0, 1);
- int rand_x = gen1.Next(0, temp_i1);
- int rand_y = gen1.Next(0, temp_i2);
- if (tones[rand_x, rand_y, z_i] % 4 == 0)
- {
- bool changed = false;
- int shift_1 = gen.Next(1, 4);
- //rand_x = gen.Next(0, temp_i1);
- //rand_y = gen.Next(0, temp_i2);
- beep_length = shift_1;
- ConsoleColor current = Console.BackgroundColor;
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- while (changed == false)
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- if (Console.BackgroundColor == colors[c_index])
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- changed = Console.BackgroundColor != colors[c_index] && Console.BackgroundColor != colors[bc_index];
- }
- changed = Console.BackgroundColor != colors[c_index] && Console.BackgroundColor != colors[bc_index];
- }
- /*while (Console.BackgroundColor == colors[c_index])
- {
- //ConsoleColor clast = Console.BackgroundColor;
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- Console.BackgroundColor = Console.BackgroundColor != colors[c_index] ? Console.BackgroundColor : colors[gen.Next(0, 15)];
- while (Console.BackgroundColor == colors[bc_index])
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- Console.BackgroundColor = Console.BackgroundColor != colors[bc_index] ? Console.BackgroundColor : colors[gen.Next(0, 15)];
- }
- }
- while (Console.BackgroundColor == colors[bc_index])
- {
- while (Console.BackgroundColor == colors[c_index])
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- Console.BackgroundColor = Console.BackgroundColor != colors[c_index] ? Console.BackgroundColor : colors[gen.Next(0, 15)];
- }
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- Console.BackgroundColor = Console.BackgroundColor != colors[c_index] ? Console.BackgroundColor : colors[gen.Next(0, 15)];
- }*/
- Console.Write(" ");
- wl.Write(" ");
- Console.BackgroundColor = current;
- tw.WriteLine(tones[rand_x, rand_y, z_i]);
- Console.Beep(tones[rand_x, rand_y, z_i], duration / beep_length);
- rand_x = gen.Next(0, temp_i1);
- rand_y = gen.Next(0, temp_i2);
- }
- else if (tones[rand_x, rand_y, z_i] % 9 == 0)
- {
- bool changed = false;
- int shift_1 = gen.Next(4, 9);
- //rand_x = gen.Next(0, temp_i1);
- //rand_y = gen.Next(0, temp_i1);
- ConsoleColor current = Console.BackgroundColor;
- beep_length = shift_1;
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- while (changed == false)
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- if (Console.BackgroundColor == colors[c_index])
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- changed = Console.BackgroundColor != colors[c_index] && Console.BackgroundColor != colors[bc_index];
- }
- changed = Console.BackgroundColor != colors[c_index] && Console.BackgroundColor != colors[bc_index];
- }
- Console.Write(" ");
- wl.Write(" ");
- Console.BackgroundColor = current;
- tw.WriteLine(tones[rand_x, rand_y, z_i]);
- Console.Beep(tones[rand_x, rand_y, z_i], duration / beep_length);
- rand_x = gen.Next(0, temp_i1);
- rand_y = gen.Next(0, temp_i2);
- }
- Console.Write(filler[wi]);
- wl.Write(filler[wi]);
- ChangeTitle();
- }
- //Console.Write("\n");
- int z_in = gen.Next(0, 1);
- int shift = gen1.Next(1, 12);
- beep_length = shift;
- Console.Beep(tones[temp_i1, temp_i2, z_in], duration / beep_length);
- ChangeTitle();
- bool changed1 = false;
- bool isPrime = true;
- for (int numbers = 1; numbers <= hi; numbers++)
- {
- int numbers_1 = numbers+2 > Console.WindowHeight ? numbers+2:numbers;
- numbers_1 = numbers_1 != 1 ? numbers_1:numbers_1+1;
- numbers_1 = numbers_1 != hi ? numbers_1 : hi + 1 > Console.WindowHeight ? hi + 1:hi-1;
- if (hi % numbers_1 == 0)
- {
- isPrime = false;
- break;
- }
- }
- if (isPrime)
- {
- Console.BackgroundColor = colors[store_color];
- }
- else if (!isPrime)
- {
- c_index = c_index < colors.Length ? c_index + 1 : 0;
- }
- while (changed1 == false)
- {
- Console.BackgroundColor = Console.BackgroundColor != colors[bc_index] ? Console.BackgroundColor:colors[gen1.Next(0,15)];
- if (Console.BackgroundColor == colors[bc_index])
- {
- Console.BackgroundColor = colors[gen.Next(0, 15)];
- changed1 = Console.BackgroundColor != colors[bc_index];
- }
- changed1 = Console.BackgroundColor != colors[bc_index];
- }
- //Console.Beep(tones[temp_i1, temp_i2, z_i], 30);
- }
- wl.Flush();
- ms.Position = 0;
- var sr = new System.IO.StreamReader(ms);
- var myStr = sr.ReadToEnd();
- string filename = String.Format("pattern{0}.txt", temp_i2);
- System.IO.File.WriteAllText(path + @"\" + filename, myStr);
- tw.Flush();
- store.Position = 0;
- var sr2 = new System.IO.StreamReader(store);
- store.Position = 0;
- myStr = sr2.ReadToEnd();
- System.IO.File.WriteAllText(path + @"\" + filename1, myStr);
- }
- }
- }s_index--;
- }while (s_index != 0);
- }
- }
- public static void ChangeTitle()
- {
- if (title_init != "")
- {
- ChangeTitle(title_init);
- }
- Random gen = new Random();
- string title = Console.Title;
- int index = 0;
- char[] t_chars = title.ToCharArray();
- title = "";
- foreach (char a in t_chars)
- {
- t_chars[index] = (char)gen.Next(((((int)a) * -1) + ((int)a)) + 33, 126);
- title += t_chars[index];
- index++;
- }
- index = 0;
- Console.Title = title;
- }
- public static void ChangeTitle(string title)
- {
- Random gen = new Random();
- int index = 0;
- char[] t_chars = title.ToCharArray();
- title = "";
- foreach (char a in t_chars)
- {
- t_chars[index] = (char)gen.Next(((((int)a) * -1) + ((int)a)) + 33, 126);
- title += t_chars[index];
- index++;
- }
- Console.Title = title;
- }
- /*public static void Ticked()
- {
- time.Start();
- time.Elapsed += Time_Elapsed;
- }
- private static void Time_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
- {
- if(time.Interval < 100)
- {
- time.Interval += 1;
- }
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement