예제 #1
0
        public static void Intro()
        {
            // Intro animation
            Console.Clear();
            Gfx.rockArt();
            Function.pause(2);
            Console.Clear();
            Gfx.paperArt();
            Function.pause(2);
            Console.Clear();
            Gfx.scissorArt();
            Function.pause(2);
            Console.Clear();

            Console.WriteLine("Welcome to Roshambo");
            Function.pause(1);
            Console.WriteLine("    The game of..");
            Function.pause(1);
            Console.Write("Rock");
            Function.pause(1);
            Console.Write("\tPaper");
            Function.pause(1);
            Console.Write("\tScissors");


            Console.WriteLine("\nPlease enter your name:");
            Program.p1.PlayerName = (Console.ReadLine());
            Function.pause(1);
            Console.WriteLine($"Welcome {Program.p1.PlayerName}");
            Function.pause(2);
            Console.Clear();
        }
예제 #2
0
        public static void PlayGame()
        {
            while (true)
            {
                string selection;
                int    aiSelection = Function.RandomNumber();
                Console.Clear();
                Console.WriteLine("Please select:");
                Console.WriteLine("1. Rock\n2. Paper\n3. Scissors\n4. Quit");

                selection = Console.ReadLine();

                Console.WriteLine("\n" + p1.PlayerName);

                if (selection == "4")
                {
                    break;
                }
                switch (selection)
                {
                case "1":
                    Gfx.rockArt();
                    Console.WriteLine("Rock");
                    break;

                case "2":
                    Gfx.paperArt();
                    Console.WriteLine("Paper");
                    break;

                case "3":
                    Gfx.scissorArt();
                    Console.WriteLine("Scissors");
                    break;

                default:
                    Console.WriteLine("Invalid selection");
                    break;
                }

                Console.WriteLine("\n\nVS\n\n");

                Console.WriteLine("Artificial Intelligence");

                switch (aiSelection)
                {
                case 1:
                    Gfx.rockArt();
                    Console.WriteLine("Rock");
                    break;

                case 2:
                    Gfx.paperArt();
                    Console.WriteLine("Paper");
                    break;

                case 3:
                    Gfx.scissorArt();
                    Console.WriteLine("Scissors");
                    break;
                }

                int weapon = GameLogic.GetWinner(int.Parse(selection), aiSelection);
                if (weapon == 0)
                {
                    Console.WriteLine("Draw!!");
                    p1.DrawCount = 1;
                }
                else if (weapon == (int.Parse(selection)))
                {
                    Console.WriteLine("You win!!");
                    p1.WinCount = 1;
                }
                else
                {
                    Console.WriteLine("You lose..");
                    p1.LoseCount = 1;
                }
                Function.pause(6);
            }
        }