コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Rock, Paper, Scissors!");
            Console.Write("Enter your name: ");
            string userName = Console.ReadLine();

            Validator.GetUserName(userName);

            do
            {
                string playerSelection = RoshamboApp.StartRoshamboApp();

                string userRoshambo = UserPlayer.GenerateRoshambo();

                UserPlayer player = new UserPlayer(userName, userRoshambo);

                int roshamboValue = 0;

                if (playerSelection == "b")
                {
                    roshamboValue   = Bababooie.GetRoshamboValue();
                    playerSelection = "Bababooie";
                }

                if (playerSelection == "l")
                {
                    roshamboValue   = 1;
                    playerSelection = "Left Shark";
                }

                Console.WriteLine($"{player.UserName}: {player.RoshamboValue}");
                Console.WriteLine($"{playerSelection}: {roshamboValue}");

                if (userRoshambo == "1" && roshamboValue == 1)
                {
                    Console.WriteLine("Draw!");
                }
                if ((userRoshambo == "1" && roshamboValue == 2) || (userRoshambo == "2" && roshamboValue = 1))
                {
                    Console.WriteLine($"{playerSelection} wins!");
                }
                if ((userRoshambo == "1" && roshamboValue == 3) || (userRoshambo == "2" && roshamboValue = 1))
                {
                    Console.WriteLine($"{player.UserName} wins!");
                }
                if (userRoshambo == "2" && roshamboValue == 1)
                {
                    Console.WriteLine("Draw!");
                }


                Console.Write("Play again? (y/n): ");
            } while (Console.ReadLine().Equals("y", StringComparison.OrdinalIgnoreCase));


            Console.WriteLine("Goodbye.");
            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: hatcha144/Lab13
        static void Main(string[] args)
        {
            RoshamboApp rps = new RoshamboApp();
            User        u   = new User();
            string      restart;

            do
            {
                Console.WriteLine("Welcome to Rock, Paper,Scissors!");
                Console.ReadLine();
                Player Opponent = rps.Opponent();

                rps.Gameselect(u, Opponent);
                Console.WriteLine("Do you wish to continue? (Y or N");
                restart = Console.ReadLine();
            }while(restart.ToLower() == "y");
        }
コード例 #3
0
        public override Roshambo GenerateRoshambo()
        {
            //get user's weapon
            string choice = RoshamboApp.GetUserInput("CHOOSE YOUR WEAPON!\n1. ROCK! (MOST DURABLE OF ALL WEAPONS! WEAK AGAINST TREE PULP!)\n2. PAPER! (BEST COVERAGE TO SUPPRESS YOUR ENEMIES! CAN BE SHEARED WITH BLADES!)\n" +
                                                     "3. SCISSORS! (SHARP EDGES WITH WHICH TO SHREAD THE WEAK! DON'T LET ITS HINGE BE BASHED!)", "CHOOSE YOUR WEAPON! I WON'T ASK AGAIN! WELL... I WILL, BUT I WON'T BE HAPPY ABOUT IT.", "1/2/3/paper/rock/scissors");

            if (choice == "1" || choice.ToLower() == "rock" || choice.ToLower() == "rock!")
            {
                return(Roshambo.rock);
            }
            else if (choice == "2" || choice.ToLower() == "paper" || choice.ToLower() == "paper!")
            {
                return(Roshambo.paper);
            }
            else
            {
                return(Roshambo.scissors);
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            UserPlayer user = new UserPlayer();

            Prompts.SayHello();
            Prompts.GetUserName(user);

            bool whichOppenent = RoshamboApp.AskForOppenent();

            if (whichOppenent == true)
            {
                MatchupVsOpponent1.DecideWinner(user);
            }


            else
            {
                MatchupVsOppenent2.DecideWinner(user);
            }
        }
コード例 #5
0
 static void Main(string[] args)
 {
     RoshamboApp rps = new RoshamboApp();
 }
コード例 #6
0
 static void Main(string[] args)
 {
     RoshamboApp.RunApplication();
 }
コード例 #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Roshambo.");

            Console.WriteLine("Enter your name");
            string name = Console.ReadLine();



            Console.WriteLine("Would you like to play against The Rock or AI?(r/a) Enter No to quit.");

            Validator opponentValidator = new Validator();

            string playerChosen = opponentValidator.ValidateUsersInput();



            bool keepGoing = true;

            while (keepGoing)
            {
                Console.WriteLine("Rock, Paper, or Scissors?");
                string myInput = Console.ReadLine();



                RoshamboApp opponent = new RoshamboApp(playerChosen);
                //
                String output = opponent.ChoosAPlayer(playerChosen);
                Console.WriteLine("Opponent chooses:" + output);

                if (myInput.ToLower() == "scissors")
                {
                    if (output == "Rock")
                    {
                        Console.WriteLine("You Lose :(");
                    }
                    else if (output == "Paper")
                    {
                        Console.WriteLine("You Win!");
                    }
                    else if (output == "Scissors")
                    {
                        Console.WriteLine("Draw!");
                    }
                }
                else
                {
                    if (myInput.CompareTo(output) == 0)
                    {
                        Console.WriteLine("Draw!");
                    }
                    else if (myInput.CompareTo(output) > 0)
                    {
                        Console.WriteLine("You Lose :(");
                    }
                    else if (myInput.CompareTo(output) < 0)
                    {
                        Console.WriteLine("You Win!");
                    }
                    else if (output.CompareTo(myInput) == 0)
                    {
                        Console.WriteLine("Draw!");
                    }
                    else if (output.CompareTo(myInput) < 0)
                    {
                        Console.WriteLine("You Win!");
                    }
                    else if (output.CompareTo(myInput) > 0)
                    {
                        Console.WriteLine("You lose!");
                    }
                }


                Console.WriteLine("Play again? (y/n)");
                string playAgain = Console.ReadLine();
                if (playAgain == "n")
                {
                    keepGoing = false;
                }
                else
                {
                    keepGoing = true;
                }
            }

            // Console.WriteLine("Your opponent: " + opponent.ChoosAPlayer(playerChosen));
            Console.WriteLine("TY");
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: jcollins14/Lab13
        static void Main()
        {
            RoshamboApp game = new RoshamboApp();

            game.Play();
        }