Beispiel #1
0
        // Exit program function
        static void exitProgram()
        {
            Varibles var = new Varibles();

            Console.WriteLine("Closing program in 500 milliseconds...");
            Console.ForegroundColor = var.preColorFG;
            Console.BackgroundColor = var.preColorBG;
            System.Threading.Thread.Sleep(500);
            Environment.Exit(1);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Initalizes Program
            Varibles var = new Varibles();

            initProgram();

            // Introducing Player
            Console.Write("Hello! What is your name? ");
            Console.ForegroundColor = ConsoleColor.Gray;
            var.playerName          = Console.ReadLine();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Nice to meet you, {0}.", var.playerName);
            Console.WriteLine();

            // Repeatedly asks player question then produces a random result
            while (true)
            {
                Console.Write("What is your question for the 8 Ball, {0}? ", var.playerName);
                Console.ForegroundColor = ConsoleColor.Gray;
                var.askedQuestion       = Console.ReadLine();
                Console.ForegroundColor = ConsoleColor.White;

                if (var.askedQuestion == "exit")
                {
                    exitProgram();
                }

                switch (var.randomNumber.Next(4))
                {
                case 0:
                    Console.WriteLine(var.responcesAffirmative1.GetValue(var.randomNumber.Next(4)));
                    Console.WriteLine();
                    break;

                case 1:
                    Console.WriteLine(var.responcesAffirmative2.GetValue(var.randomNumber.Next(4)));
                    Console.WriteLine();
                    break;

                case 2:
                    Console.WriteLine(var.responcesNonCommittal.GetValue(var.randomNumber.Next(4)));
                    Console.WriteLine();
                    break;

                case 3:
                    Console.WriteLine(var.responcesNegative.GetValue(var.randomNumber.Next(4)));
                    Console.WriteLine();
                    break;
                }
            }
        }