static void Main(string[] args)
        {
            int numberOfPlayers;

            NumberOfPlayers numberofplayers = new NumberOfPlayers();
            Player1 player1 = new Player1();
            Player2 player2 = new Player2();
            PlayerChooseShape shapechoice = new PlayerChooseShape();
            CheckWinner checkwinner = new CheckWinner();
            UserChooseGameMode userchoosegamemode = new UserChooseGameMode();
            UserPickHandSign userpickhandsign = new UserPickHandSign();
            DisplayScore displayscore = new DisplayScore();
            WriteToDocument writetodocument = new WriteToDocument();
            ReadFromDocument readfromdocument = new ReadFromDocument();


            readfromdocument.WriteDocumentData();

            numberOfPlayers = userchoosegamemode.pickNumberOfPlayers(player1, player2, numberofplayers);

            userpickhandsign.pickHandSign(numberOfPlayers, checkwinner, shapechoice, player1, player2);

            checkwinner.getScore();

            displayscore.DisplayWinner(player1, player2, checkwinner);

            checkwinner.SignClassOutput();

            writetodocument.writeTextToDocument(player1, player2);

            Console.ReadLine();
        }
 public void DisplayWinner(Player1 player1, Player2 player2, CheckWinner checkwinner)
 {
     switch (checkwinner.outcome)
     {
         case 0:
             Console.WriteLine("Players have tied.  Play again.");
             break;
         case 1:
             Console.WriteLine(player1.Player1Name + " has won.");
             player1.Win++;
             player2.Win = 0;
             break;
         case 2:
             Console.WriteLine(player2.Player2Name + " has won.");
             player2.Win++;
             player1.Win = 0;
             break;
         case 3:
             Console.WriteLine(player1.Player1Name + " has won.");
             player1.Win++;
             player2.Win = 0;
             break;
         case 4:
             Console.WriteLine(player2.Player2Name + " has won.");
             player2.Win++;
             player1.Win = 0;
             break;
     }
 }
        public int pickNumberOfPlayers (Player1 player1, Player2 player2, NumberOfPlayers numberofplayers)
        {
            int numberOfPlayers;
            bool userPicksValidNumber = false;
            numberOfPlayers = numberofplayers.getNumberOfPlayers();

            while (userPicksValidNumber == false)
            {
                switch (numberOfPlayers)
                {
                    case 2:
                        userPicksValidNumber = true;
                        player1.getPlayer1name();
                        player2.getPlayer2name();
                        break;
                    case 1:
                        userPicksValidNumber = true;
                        player1.getPlayer1name();
                        player2.Player2Name = "HAL 9K";
                        break;
                    default:
                        numberOfPlayers = numberofplayers.getNumberOfPlayers();
                        break;
                }
            }

            return numberOfPlayers;
                    }
 public void pickHandSign(int numberOfPlayers, CheckWinner checkwinner, PlayerChooseShape shapeChoice, Player1 player1, Player2 player2)
 {  switch (numberOfPlayers)
     {
         case 1:
             checkwinner.player1shape = shapeChoice.getPlayerHandsign();
             checkwinner.player2shape = rnd.Next(5);
         break;
         case 2:
             Console.WriteLine(player1.Player1Name + " it is your turn.");
             checkwinner.player1shape = shapeChoice.getPlayerHandsign();
             Console.Clear();
             Console.WriteLine(player2.Player2Name + "it is your turn.");
             checkwinner.player2shape = shapeChoice.getPlayerHandsign();
             Console.Clear();
             break;
 }
 }
        public void pickHandSign(int numberOfPlayers, CheckWinner checkwinner, PlayerChooseShape shapeChoice, Player1 player1, Player2 player2)
        {
            switch (numberOfPlayers)
            {
            case 1:
                checkwinner.player1shape = shapeChoice.getPlayerHandsign();
                checkwinner.player2shape = rnd.Next(5);
                break;

            case 2:
                Console.WriteLine(player1.Player1Name + " it is your turn.");
                checkwinner.player1shape = shapeChoice.getPlayerHandsign();
                Console.Clear();
                Console.WriteLine(player2.Player2Name + "it is your turn.");
                checkwinner.player2shape = shapeChoice.getPlayerHandsign();
                Console.Clear();
                break;
            }
        }
        public void writeTextToDocument(Player1 player1, Player2 player2)
        {
            string[] playernames = { player1.Player1Name, player2.Player2Name };

            System.IO.File.WriteAllLines(@"C:\Users\Mueller\Documents\Visual Studio 2015\Projects\RockPaperScissorsLizardSpock\Muellerplayers.txt", playernames);
        }
Beispiel #7
0
        public void writeTextToDocument(Player1 player1, Player2 player2)
        {
            string[] playernames = { player1.Player1Name, player2.Player2Name };

            System.IO.File.WriteAllLines(@"C:\Users\Mueller\Documents\Visual Studio 2015\Projects\RockPaperScissorsLizardSpock\Muellerplayers.txt", playernames);
        }