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;
- using System.Threading;
- namespace Magic8Ball
- {
- class Program
- {
- static void Main(string[] args)
- {
- programname();
- // Variables
- Random randomObj = new Random(); // random gen
- ConsoleColor oldColor = Console.ForegroundColor; // old color
- while (true) // make sure everything repeats
- {
- int randomNumber = randomObj.Next(4) + 1; // random var
- returncolor();
- Console.Write("Ask a question?: ");
- Console.ForegroundColor = oldColor;
- String yourquestion = Console.ReadLine();
- returnnewcolor();
- if (yourquestion.ToLower() == "quit")
- {
- break;
- }
- if (yourquestion.ToLower() == "you suck")
- {
- Console.WriteLine("You suck even more. Bye.");
- break;
- }
- if (yourquestion.ToLower() == "clear")
- {
- Console.Clear();
- continue;
- }
- if (yourquestion.ToLower() == "")
- {
- Console.WriteLine("You need to enter a question fool!");
- continue;
- }
- if (yourquestion.ToLower() == "cls")
- {
- Console.Clear();
- continue;
- }
- switch (randomNumber)
- {
- case 1:
- Console.WriteLine("YES!");
- break;
- case 2:
- Console.WriteLine("NO!");
- break;
- case 3:
- Console.WriteLine("HELL NO!");
- break;
- case 4:
- Console.WriteLine("OMG YES!");
- break;
- default:
- Console.WriteLine("Ask again later.");
- break;
- }
- }
- // back to regular code here
- Console.ForegroundColor = ConsoleColor.Green; // text color
- Console.Write("\n\n");
- }
- static void programname()
- {
- Console.WriteLine("Magic 8 Ball by Preston Cammarata");
- }
- static void returncolor()
- {
- Console.ForegroundColor = ConsoleColor.Green; // text color
- }
- static void returnnewcolor()
- {
- Console.ForegroundColor = ConsoleColor.Red; // text color again
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement