public void DetermineWinner(Player player1,Player player2, Game game) { playerChoices.Add(player1.Selection); playerChoices.Add(player2.Selection); Winner = (3 + playerChoices[0] - playerChoices[1]) % 3; if (Winner == 1) { Console.WriteLine(); Console.WriteLine("{0} Wins!", player1.Name); player1.wins++; player2.losses++; } else if (Winner == 2) { Console.WriteLine("{0} Wins!", player2.Name); player2.wins++; player1.losses++; } else { Console.WriteLine("You tied!"); player1.Ties++; player2.Ties++; } }
static void Main(string[] args) { //Game.MainMenu(); //int userInput = Convert.ToInt32(Console.ReadLine()); //switch (userInput) //{ // case 1: // Console.WriteLine("This feature is coming soon!"); // break; // case 2: // Console.WriteLine("2 player mode selected"); // break; // case 3: // game.PlayAgain = false; // Console.WriteLine("GoodBye"); // Environment.Exit(userInput); // break; // default: // Console.WriteLine("Please enter a valid selection"); // Game.MainMenu(); // break; //} //game.GameIntro(); //game.PlayAgain = true; Game game = new Game(); PlayerFactory playerFactory = new PlayerFactory(); Player player1 = new Player(); Player player2 = new Player(); playerFactory.SetPlayerData(player1, player2); game.DetermineWinner(); List<Player> matchList = new List<Player>(); MyFileWriter fileWriter = new MyFileWriter("Rock_Paper_Scissors.txt"); fileWriter.WriteToFile(player1); fileWriter.WriteToFile(player2); //SymbolList<Rock,Paper,Scissors,Lizard,Spock> symbolList = new SymbolList<Rock, Paper, Scissors, Lizard, Spock>(); //PlayerFactory playerFactory = new PlayerFactory(); //Game game = new Game(); //PlayerFactory player1 = new PlayerFactory(); //PlayerFactory player2 = new PlayerFactory(); //player1.player1.Name = playerFactory.player1.setPlayerName(); //player2.player2.Name = playerFactory.player2.setPlayerName(); //PlayerFactory playerFactory = new PlayerFactory(); //playerFactory.MakePlayer(); //Console.WriteLine(playerFactory.MatchupList[0].Name); // playerFactory.setPlayerName(player1); // playerFactory.SetPlayerSelection(player1); // Player player2 = new Player(); // playerFactory.setPlayerName(player2); // playerFactory.SetPlayerSelection(player2); // Game game = new Game(); // game.DetermineWinner(player1,player2); }
public void Can_play_the_game(Game.Throws player1, Game.Throws player2, bool expectedResult) { var result = Game.Play(player1, player2); result.Won.Should().Be(expectedResult); Debug.WriteLine(result.ToString()); }
public GameTests() { Game = new Game(); }