static void Main(string[] args)
		{
            List<string> mainChoices = new List<string>(new[] {
                "1: New One Player Game",
                "2: New Two Player Game",
                "3: Display High Scores",
                "4: Quit"
                });
            List<string> playerChoices = new List<string>(new[] {
                "1: Rock",
                "2: Spock",
                "3: Paper",
                "4: Lizard",
                "5: Sissors"
                });
            List<string> gameOverChoices = new List<string>(new[] {
                "1: Play Again",
                "2: Start Over",
                "3: Quit"
                });
            Menu mainMenu = new Menu("What would you like to do", mainChoices);
            Menu playerOneMenu = new Menu("Player One, What do you choose", playerChoices);
            Menu playerTwoMenu = new Menu("Player Two, What do you choose", playerChoices);
            Menu gameOverMenu = new Menu("What would you like to do", gameOverChoices);
            Display display = new Display(mainMenu, playerOneMenu, playerTwoMenu, gameOverMenu);
            display.DisplayMenus();

		}
        static void Main(string[] args)
        { 

            List<int> highScore = new List<int>()
            { 0 };
            Display display = new Display();

            string p1Name = display.player1Name;
            string p2Name = display.player2Name;
            Player player1 = new Player(p1Name, 0, highScore,0,0);
            Player player2 = new Player(p2Name, 0, highScore, 0, 0);

            MyFileWriter fileWriter = new MyFileWriter("Rock_Paper_Scissors.txt");
            fileWriter.WriteToFile(player1);
            fileWriter.WriteToFile(player2);        


            
            




            
            
            
            
            
            

        }
 public RunGame()
 {
     scissor = new Scissor("Scissor");
     paper = new Paper("Paper");
     rock = new Rock("Rock");
     spock = new Spock("Spock");
     lizard = new Lizard("Lizard");
     player = new Player();
     ai = new AI();
     display = new Display();
 }
Exemple #4
0
        public void VsComputer()
        {
            display = new Display();
            player = new Player();
            ai = new AI("AI");
            rock = new Rock("Rock");
            paper = new Paper("Paper");
            scissors = new Scissors("Scissors");
            bool gameActive = true;

            while (gameActive == true)
            {
                display.OutputToFile("ScoresVsAI.txt");
                Console.WriteLine("New game? yes/no");
                string userContinue = Console.ReadLine().ToLower();
                Console.Clear();
                display.DisplayScoreBoardVsAI();

                if (userContinue == "no")
                {
                    display.OutputToFile("ScoresVsAI.txt");
                    break;
                }

                if (userContinue == "yes")
                {
                    ai.AITurn();
                    player.Player1Input();
                    Console.WriteLine(Environment.NewLine);

                    //rock
                    if (ai.aiChoice == "rock")
                    {
                        if (player.player1Choice == "rock")
                        {
                            Console.WriteLine("The {0} chose {1}", ai.Name, rock.Name);
                            Console.WriteLine("It is a tie.\r\n");
                        }
                        else if (player.player1Choice == "paper")
                        {
                            display.player1Score++;
                            Console.WriteLine("The {0} chose {1}", ai.Name, rock.Name);
                            paper.DisplayWin(player.player1Choice, ai.aiChoice);
                            Console.WriteLine("You win!\r\n");
                        }
                        else if (player.player1Choice == "scissors")
                        {
                            display.aiScore++;
                            Console.WriteLine("The {0} chose {1}", ai.Name, rock.Name);
                            scissors.DisplayLoss(player.player1Choice, ai.aiChoice);
                            Console.WriteLine("{0} wins!\r\n",ai.Name);
                        }
                        else
                        {
                            Console.WriteLine("You must choose Rock, Paper, or Scissors!\r\n");
                        }

                    }
                    //paper
                    else if (ai.aiChoice == "paper")
                    {
                        if (player.player1Choice == "rock")
                        {
                            Console.WriteLine("The {0} chose {1}", ai.Name, rock.Name);
                            rock.DisplayLoss(player.player1Choice, ai.aiChoice);
                            Console.WriteLine("{0} wins!\r\n",ai.Name);
                            display.aiScore++;
                        }
                        else if (player.player1Choice == "paper")
                        {
                            Console.WriteLine("The {0} chose {1}", ai.Name, paper.Name);
                            Console.WriteLine("It is a tie\r\n");                            

                        }
                        else if (player.player1Choice == "scissors")
                        {
                            Console.WriteLine("The {0} chose {1}", ai.Name, paper.Name);
                            scissors.DisplayWin(player.player1Choice, ai.aiChoice);
                            Console.WriteLine("You win!\r\n");
                            display.player1Score++;

                        }
                        else
                        {
                            Console.WriteLine("You must choose Rock, Paper, or Scissors!\r\n");
                        }
                    }

                    //scissors
                    else if (ai.aiChoice == "scissors")
                    {
                        if (player.player1Choice == "rock")
                        {
                            //ai scissors, you rock = win
                            display.player1Score++;
                            Console.WriteLine("The {0} chose {1}", ai.Name, scissors.Name);
                            rock.DisplayWin(player.player1Choice, ai.aiChoice);
                            Console.WriteLine("You win!\r\n");
                        }
                        else if (player.player1Choice == "paper")
                        {
                            //ai scissors, you paper = lose
                            display.aiScore++;
                            Console.WriteLine("The {0} chose {1}", ai.Name, scissors.Name);
                            paper.DisplayLoss(player.player1Choice, ai.aiChoice);
                            Console.WriteLine("{0} wins!\r\n", ai.Name);
                        
                        }
                        else if (player.player1Choice == "scissors")
                        {
                            Console.WriteLine("The {0} chose {1}", ai.Name, scissors.Name);
                            Console.WriteLine("It is a tie\r\n");
                        }
                        else
                        {
                            Console.WriteLine("You must choose Rock, Paper, or Scissors!\r\n");
                        }

                    }
                }
            }
        }