Advertisement
Guest User

TheLights.cs

a guest
Dec 22nd, 2016
2,471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.28 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections;
  4. using static System.Console;
  5. using System.Collections.Generic;
  6. using static System.Threading.Thread;
  7.  
  8. public class TheLights
  9. {
  10.     public static class cmdWritings
  11.     {
  12.         public static void WriteAt(string s, int x, int y)
  13.         {
  14.         try
  15.             {
  16.             SetCursorPosition(x, y);
  17.             Write(s);
  18.             }
  19.         catch (ArgumentOutOfRangeException e)
  20.             {
  21.             Clear();
  22.             WriteLine(e.Message);
  23.             }
  24.         }
  25.     }
  26.     public static void Main()
  27.     {
  28.     //Main Code
  29.         Clear();
  30.         WriteLine("Hello, welcome to the Upside Down.");
  31.         WriteLine("To leave a message, please use the prompt, then hit enter.");
  32.         WriteLine("LEGEND: Letters A-Z | PAUSE<NUMBER_OF_MILISECONDS> – Insert a delay | <SPACE> – Required to separate commands");
  33.  
  34.         WriteLine("What would you like the wall to say?");
  35.         String spoopiLights = Console.ReadLine();
  36.         String[] lightCommand = spoopiLights.Split(' ');
  37.         WriteLine("Alright, here we go.");
  38.  
  39.         Clear();
  40.         int a = 0;
  41.         int c = 1;
  42.         int d = 0;
  43.         int g = 0;
  44.         Char w = 'A';
  45.         // System.IO.StreamWriter file = new System.IO.StreamWriter("C:\\Users\\willn\\Documents\\map.txt");
  46.         for (int b = 0; b < 26; b = b+1)
  47.         {
  48.             cmdWritings.WriteAt(w.ToString(), g, c);
  49.             // file.WriteLine(w.ToString() + " – " + g + "," + c);
  50.             w++;
  51.             a = a+2;
  52.             g = g+2;
  53.             if (a == 16 || a == 34 && d < 2)
  54.             {
  55.                 c = c+2;
  56.                 g = 0;
  57.                 d = d+1;
  58.             }
  59.         }
  60.         int i = 0;
  61.         foreach (String item in lightCommand)
  62.         {
  63.             if (lightCommand[i].ToString().Contains("PAUSE"))
  64.             {
  65.                 Sleep(Int32.Parse(lightCommand[i].Replace("PAUSE","")));
  66.             }else
  67.             {
  68.                 if (lightCommand[i].Equals("A")){
  69.                     Console.ForegroundColor = ConsoleColor.White;
  70.                     cmdWritings.WriteAt("█", 0, 2);
  71.                     Sleep(500);
  72.                     cmdWritings.WriteAt("\b ", 1, 2);
  73.                 }
  74.                 if (lightCommand[i].Equals("B")){
  75.                     Console.ForegroundColor = ConsoleColor.Blue;
  76.                     cmdWritings.WriteAt("█", 2, 2);
  77.                     Sleep(500);
  78.                     cmdWritings.WriteAt("\b ", 3, 2);
  79.                 }
  80.                 if (lightCommand[i].Equals("C")){
  81.                     Console.ForegroundColor = ConsoleColor.Red;
  82.                     cmdWritings.WriteAt("█", 4, 2);
  83.                     Sleep(500);
  84.                     cmdWritings.WriteAt("\b ", 5, 2);
  85.                 }
  86.                 if (lightCommand[i].Equals("D")){
  87.                     Console.ForegroundColor = ConsoleColor.Green;
  88.                     cmdWritings.WriteAt("█", 6, 2);
  89.                     Sleep(500);
  90.                     cmdWritings.WriteAt("\b ", 7, 2);
  91.                 }
  92.                 if (lightCommand[i].Equals("E")){
  93.                     Console.ForegroundColor = ConsoleColor.Blue;
  94.                     cmdWritings.WriteAt("█", 8, 2);
  95.                     Sleep(500);
  96.                     cmdWritings.WriteAt("\b ", 9, 2);
  97.                 }
  98.                 if (lightCommand[i].Equals("F")){
  99.                     Console.ForegroundColor = ConsoleColor.Yellow;
  100.                     cmdWritings.WriteAt("█", 10, 2);
  101.                     Sleep(500);
  102.                     cmdWritings.WriteAt("\b ", 11, 2);
  103.                 }
  104.                 if (lightCommand[i].Equals("G")){
  105.                     Console.ForegroundColor = ConsoleColor.Red;
  106.                     cmdWritings.WriteAt("█", 12, 2);
  107.                     Sleep(500);
  108.                     cmdWritings.WriteAt("\b ", 13, 2);
  109.                 }
  110.                 if (lightCommand[i].Equals("H")){
  111.                     Console.ForegroundColor = ConsoleColor.Green;
  112.                     cmdWritings.WriteAt("█", 14, 2);
  113.                     Sleep(500);
  114.                     cmdWritings.WriteAt("\b ", 15, 2);
  115.                 }
  116.                 //Row 2
  117.                 if (lightCommand[i].Equals("I")){
  118.                     Console.ForegroundColor = ConsoleColor.Green;
  119.                     cmdWritings.WriteAt("█", 0, 4);
  120.                     Sleep(500);
  121.                     cmdWritings.WriteAt("\b ", 1, 4);
  122.                 }
  123.                 if (lightCommand[i].Equals("J")){
  124.                     Console.ForegroundColor = ConsoleColor.Red;
  125.                     cmdWritings.WriteAt("█", 2, 4);
  126.                     Sleep(500);
  127.                     cmdWritings.WriteAt("\b ", 3, 4);
  128.                 }
  129.                 if (lightCommand[i].Equals("K")){
  130.                     Console.ForegroundColor = ConsoleColor.Blue;
  131.                     cmdWritings.WriteAt("█", 4, 4);
  132.                     Sleep(500);
  133.                     cmdWritings.WriteAt("\b ", 5, 4);
  134.                 }
  135.                 if (lightCommand[i].Equals("L")){
  136.                     Console.ForegroundColor = ConsoleColor.Green;
  137.                     cmdWritings.WriteAt("█", 6, 4);
  138.                     Sleep(500);
  139.                     cmdWritings.WriteAt("\b ", 7, 4);
  140.                 }
  141.                 if (lightCommand[i].Equals("M")){
  142.                     Console.ForegroundColor = ConsoleColor.Yellow;
  143.                     cmdWritings.WriteAt("█", 8, 4);
  144.                     Sleep(500);
  145.                     cmdWritings.WriteAt("\b ", 9, 4);
  146.                 }
  147.                 if (lightCommand[i].Equals("N")){
  148.                     Console.ForegroundColor = ConsoleColor.Red;
  149.                     cmdWritings.WriteAt("█", 10, 4);
  150.                     Sleep(500);
  151.                     cmdWritings.WriteAt("\b ", 11, 4);
  152.                 }
  153.                 if (lightCommand[i].Equals("O")){
  154.                     Console.ForegroundColor = ConsoleColor.Blue;
  155.                     cmdWritings.WriteAt("█", 12, 4);
  156.                     Sleep(500);
  157.                     cmdWritings.WriteAt("\b ", 13, 4);
  158.                 }
  159.                 if (lightCommand[i].Equals("P")){
  160.                     Console.ForegroundColor = ConsoleColor.Green;
  161.                     cmdWritings.WriteAt("█", 14, 4);
  162.                     Sleep(500);
  163.                     cmdWritings.WriteAt("\b ", 15, 4);
  164.                 }
  165.                 if (lightCommand[i].Equals("Q")){
  166.                     Console.ForegroundColor = ConsoleColor.Red;
  167.                     cmdWritings.WriteAt("█", 16, 4);
  168.                     Sleep(500);
  169.                     cmdWritings.WriteAt("\b ", 17, 4);
  170.                 }
  171.                 //Line 3
  172.                 if (lightCommand[i].Equals("R")){
  173.                     Console.ForegroundColor = ConsoleColor.Green;
  174.                     cmdWritings.WriteAt("█", 0, 6);
  175.                     Sleep(500);
  176.                     cmdWritings.WriteAt("\b ", 1, 6);
  177.                 }
  178.                 if (lightCommand[i].Equals("S")){
  179.                     Console.ForegroundColor = ConsoleColor.White;
  180.                     cmdWritings.WriteAt("█", 2, 6);
  181.                     Sleep(500);
  182.                     cmdWritings.WriteAt("\b ", 3, 6);
  183.                 }
  184.                 if (lightCommand[i].Equals("T")){
  185.                     Console.ForegroundColor = ConsoleColor.Yellow;
  186.                     cmdWritings.WriteAt("█", 4, 6);
  187.                     Sleep(500);
  188.                     cmdWritings.WriteAt("\b ", 5, 6);
  189.                 }
  190.                 if (lightCommand[i].Equals("U")){
  191.                     Console.ForegroundColor = ConsoleColor.Blue;
  192.                     cmdWritings.WriteAt("█", 6, 6);
  193.                     Sleep(500);
  194.                     cmdWritings.WriteAt("\b ", 7, 6);
  195.                 }
  196.                 if (lightCommand[i].Equals("V")){
  197.                     Console.ForegroundColor = ConsoleColor.Red;
  198.                     cmdWritings.WriteAt("█", 8, 6);
  199.                     Sleep(500);
  200.                     cmdWritings.WriteAt("\b ", 9, 6);
  201.                 }
  202.                 if (lightCommand[i].Equals("W")){
  203.                     Console.ForegroundColor = ConsoleColor.Blue;
  204.                     cmdWritings.WriteAt("█", 10, 6);
  205.                     Sleep(500);
  206.                     cmdWritings.WriteAt("\b ", 11, 6);
  207.                 }
  208.                 if (lightCommand[i].Equals("X")){
  209.                     Console.ForegroundColor = ConsoleColor.Yellow;
  210.                     cmdWritings.WriteAt("█", 12, 6);
  211.                     Sleep(500);
  212.                     cmdWritings.WriteAt("\b ", 13, 6);
  213.                 }
  214.                 if (lightCommand[i].Equals("Y")){
  215.                     Console.ForegroundColor = ConsoleColor.Red;
  216.                     cmdWritings.WriteAt("█", 14, 6);
  217.                     Sleep(500);
  218.                     cmdWritings.WriteAt("\b ", 15, 6);
  219.                 }
  220.                 if (lightCommand[i].Equals("Z")){
  221.                     Console.ForegroundColor = ConsoleColor.Red;
  222.                     cmdWritings.WriteAt("█", 16, 6);
  223.                     Sleep(500);
  224.                     cmdWritings.WriteAt("\b ", 17, 6);
  225.                 }
  226.                 Sleep(200);
  227.             }
  228.             i = i+1;
  229.         }
  230.         Console.ResetColor();
  231.         Clear();
  232.     }
  233. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement