Ejemplo n.º 1
0
        public void PlayManyGamesTest()
        {
            IPlayer   player1          = new SimplePlayer();
            IPlayer   player2          = new DiscardOnlyPlayer();
            int       NumDrawGames     = 0;
            const int TotalGamesPlayed = 25;

            for (int gameNumber = 0; gameNumber < TotalGamesPlayed; gameNumber++)
            {
                Board board = new Board();
                board.AddPlayer(player1);
                board.AddPlayer(player2);

                board.PrepGame();
                board.PlayGame();

                if (board.Winner == null)
                {
                    NumDrawGames++;
                }
            }

            Debug.WriteLine(string.Format("{0} won {1}, {2} won {3}. {4} Drawn = Total {5}", player1, player1.GamesWon, player2, player2.GamesWon, NumDrawGames, TotalGamesPlayed));
            Assert.AreEqual(TotalGamesPlayed, NumDrawGames + player1.GamesWon + player2.GamesWon, "Total number of games won and drawn must match games played.");
        }
Ejemplo n.º 2
0
        private static Board DiscardOnly2PlayerSetup()
        {
            Board   board   = new Board();
            IPlayer player1 = new DiscardOnlyPlayer();
            IPlayer player2 = new DiscardOnlyPlayer();

            board.AddPlayer(player1);
            board.AddPlayer(player2);
            return(board);
        }