public static void Main(String[] args) { InputParameters input = ReadInput(args); for (int i = 0; i < input.Samples; i++) { int mySeed = input.Seed + i*313; CreateFile(i, mySeed, input.Iteration); Game aGame = new Game(Console.WriteLine, new PlayersController(3)); AnswerController answerController = new AnswerController(aGame.GiveCorrectAnswerAndCheckIfNOTWinner, aGame.wrongAnswer); aGame.add("Chet"); aGame.add("Pat"); aGame.add("Sue"); try { Random rand = new Random(mySeed); do { aGame.Roll(rand.Next(5) + 1); _notAWinner = answerController.GiveAnswer(rand.Next(9)); } while (_notAWinner); } catch (Exception ex) { Console.WriteLine(ex); } CloseStream(); } }
public void TwoPlayerRoll() { Game = new GameConfiguration().StartGame( delegate { }, null, CALIN_PLAYER, JOHN_PLAYER); AnswerController answerController = new AnswerController(Game.GiveCorrectAnswerAndCheckIfNOTWinner, Game.wrongAnswer); Assert.AreEqual(CalinPayerIndex, Game.CurrentPlayer); Game.Roll(3); answerController.GiveAnswer(new Random().Next(9)); Assert.AreEqual(JohnPlayerIndex, Game.CurrentPlayer); }
public void ThirdPlayerTurn() { var playersController = new PlayersController(3); Game = new GameConfiguration().StartGame( delegate { }, playersController, CALIN_PLAYER, JOHN_PLAYER, ANDREW_PLAYER); AnswerController answerController = new AnswerController(Game.GiveCorrectAnswerAndCheckIfNOTWinner, Game.wrongAnswer); answerController.GiveAnswer(new Random().Next(9)); answerController.GiveAnswer(new Random().Next(9)); Assert.AreEqual(ThirdPlayerIndex, Game.CurrentPlayer); Assert.AreEqual(ThirdPlayerIndex, playersController.CurrentPlayer); }