예제 #1
0
        static void Main(string[] args)
        {
            RPSGenerator rps   = new RPSGenerator();
            Rocky        r     = new Rocky(rps);
            var          rocky = r.GenerateRPS();
            Other        o     = new Other(rps);
            var          other = o.GenerateRPS();
            Console      c     = new Console();
            Score        sc    = new Score();

            int[] track = new int[2];

            var userName = c.GetUserName();

            bool run = true;

            while (run == true)
            {
                var playerName    = c.GetPlayer();                    //Rocky or Others
                var userChoiceRPS = c.GetRPSfromUser();               //r/p/s

                var human = rps.GetByString(userChoiceRPS.ToLower()); // Compares user string against the list (r/p/s) stored in RPSGenerator class

                if (playerName == "r")
                {
                    System.Console.WriteLine("Rocky: " + rocky); // rocky
                }
                else if (playerName == "o")
                {
                    System.Console.WriteLine("Other: " + other); // other
                }
                else
                {
                    System.Console.WriteLine("I did not understand that, please try again.");
                }

                System.Console.WriteLine(userName + " : " + human);              // user player

                track = sc.ScoreCard(rocky, other, human, userName, playerName); //integer array "track" keeps scores
                run   = Continue();
            }
            Score.DisplayScore(track, userName);
        }
예제 #2
0
파일: Program.cs 프로젝트: anelguel/Lab12
        static void Main(string[] args)
        {
            bool run = true;

            while (run == true)

            {
                RPSGenerator rps = new RPSGenerator();
                Rock         r   = new Rock(rps);
                Weapon       w   = new Weapon(rps);



                Console.WriteLine("Enter your name");
                string inputName = Console.ReadLine();
                Console.WriteLine("Would you like to play against TheJets or the TheSharks? (j/s)");
                string inputPlayer = Console.ReadLine();
                inputPlayer = rps.JetsSharks(inputPlayer);
                Console.WriteLine("Rock, paper, or scissors? r/p/s");
                string inputWeapon  = rps.GetByString(Console.ReadLine());
                string randomWeapon = w.GenerateRPS();



                if (inputPlayer == "TheJets") //if user input is the JETS
                {
                    Console.WriteLine(inputName + ":" + inputWeapon + "\n" + inputPlayer + ":" + r.GenerateRPS());
                }
                else if (inputPlayer == "TheSharks")//if user input is the SHARKS
                {
                    Console.WriteLine(inputName + ":" + inputWeapon + "\n" + inputPlayer + ":" + randomWeapon);
                }


                run = Continue();
            }
        }