/// <summary> /// Init the game with 2 players AIEasy /// </summary> /// <param name="randomMock">mock for the random</param> /// <returns>the game with modifications</returns> public CustomGame InitGame(Mock <IRandom> randomMock) { CustomGame customGame = randomMock == null ? new CustomGame(new AppRandom()) : new CustomGame(randomMock.Object); // Add 2 players customGame.AddPlayer("Player1", PlayerType.AIEasy); // Set point Player player = (Player)customGame.Players[0]; player.Points = 10; customGame.AddPlayer("Player2", PlayerType.AIEasy); // Set point player = (Player)customGame.Players[1]; player.Points = 5; // Launch function customGame.StartGame(); // Set current player customGame.CurrentPlayer = customGame.Players[0]; customGame.IdPlayer = 0; // Set Next Action customGame.NextAction = NextActionType.MovePenguin; return(customGame); }
public void Test_AddPlayers_NotNull() { // Init Game CustomGame customGame = new CustomGame(new AppRandom()); // Add 2 players customGame.AddPlayer("AI", PlayerType.AIEasy); customGame.AddPlayer("Human", PlayerType.Human); // Tests Assert.IsTrue(customGame.Players[0].PlayerType == PlayerType.AIEasy && customGame.Players[0].Name == "AI"); Assert.IsTrue(customGame.Players[1].PlayerType == PlayerType.Human && customGame.Players[1].Name == "Human"); Assert.IsTrue(customGame.Players[0].Identifier != customGame.Players[1].Identifier); }
/// <summary> /// Init the game /// </summary> /// <returns>game</returns> public CustomGame InitGame() { // Init game CustomGame customGame = new CustomGame(new AppRandom()); // Add 2 players customGame.AddPlayer("Player1", PlayerType.Human); customGame.AddPlayer("Player2", PlayerType.Human); // Launch function customGame.StartGame(); // Set current player customGame.CurrentPlayer = customGame.Players[0]; customGame.IdPlayer = 0; return(customGame); }
/// <summary> /// Init the game with 3 players (AIEasy, AIMedium, AIHard) /// </summary> /// <param name="randomMock">mock for the random</param> /// <returns>the game with modifications</returns> public CustomGame InitGame(Mock <IRandom> randomMock) { CustomGame customGame = randomMock == null ? new CustomGame(new AppRandom()) : new CustomGame(randomMock.Object); // Add 3 players customGame.AddPlayer("Easy", PlayerType.AIEasy); customGame.AddPlayer("Medium", PlayerType.AIMedium); customGame.AddPlayer("Hard", PlayerType.AIHard); // Launch function customGame.StartGame(); // Set current player customGame.CurrentPlayer = customGame.Players[0]; customGame.IdPlayer = 0; return(customGame); }
/// <summary> /// Init the game with 3 players (AIEasy, AIMedium, AIHard) /// </summary> /// <returns>the game with modifications</returns> private CustomGame InitGame() { CustomGame customGame = new CustomGame(new AppRandom()); // Add 3 players customGame.AddPlayer("Player1", PlayerType.AIEasy); customGame.AddPlayer("Player2", PlayerType.AIMedium); customGame.AddPlayer("Player3", PlayerType.AIHard); // Launch function customGame.StartGame(); // Set Current Player customGame.CurrentPlayer = customGame.Players[0]; customGame.IdPlayer = 0; return(customGame); }
/// <summary> /// Init the game /// </summary> /// <param name="countPlayer">number of players</param> /// <param name="randomMock">mock for random, can be null</param> /// <returns>game</returns> public CustomGame InitGame(int countPlayer, Mock <IRandom> randomMock) { // Init game CustomGame customGame = randomMock != null ? new CustomGame(randomMock.Object) : new CustomGame(new AppRandom()); // Add players for (int i = 0; i < countPlayer; i++) { customGame.AddPlayer("Player" + i, PlayerType.Human); } // Launch function customGame.StartGame(); return(customGame); }