コード例 #1
0
ファイル: Program.cs プロジェクト: edwardsdan/Lab12Actual
        public static void PlayGame(ref int wins, ref int losses, Human UserName, ref Player Opponent)
        {
            while (true)
            {
                Roshambo Input = UserName.generateRoshambo(new Roshambo());
                Roshambo AI    = Opponent.generateRoshambo(Input);

                if (Opponent.Name == "Dr. K")
                {
                    Counter(ref wins, ref losses, UserName, Opponent, Input, AI);
                }
                if (Opponent.Name == "Grant Chirpus")
                {
                    Counter(ref wins, ref losses, UserName, Opponent, Input, AI);
                }
                if (Opponent.Name == "Hulk Hogan")
                {
                    Counter(ref wins, ref losses, UserName, Opponent, Input, AI);
                }

                if (Validate.Continue() == true)
                {
                    if (Validate.NewOpponent() == true)
                    {
                        Opponent = RoshamboApp.ChooseOpponent();
                    }
                    Console.Clear();
                }
                else
                {
                    break;
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: edwardsdan/Lab12Actual
        static void Main(string[] args)
        {
            int wins   = 0;
            int losses = 0;

            Console.WriteLine("Hey there! What's your name?");
            Human UserName = new Human(Console.ReadLine());

            Player Opponent = RoshamboApp.ChooseOpponent();

            PlayGame(ref wins, ref losses, UserName, ref Opponent);
            Console.WriteLine($"You won {wins} and lost {losses}");
        }