public TestPlayer PlayMatch(TestPlayer player1, IRockPaperScissorsBot player1Bot, TestPlayer player2, IRockPaperScissorsBot player2Bot)
        {
            var rules = new StandardGameRules();

            InitializeTestPlayer(player1);
            InitializeTestPlayer(player2);

            var tiePoints = 0;
            var decisions = 0;
            var pointsToWin = rules.PointsToWin;

            while (
                player1.Points >= pointsToWin ||
                player2.Points >= pointsToWin ||
                decisions <= rules.MaximumGames)
            {
                var player1Move = player1Bot.MakeMove(player1, player2, null);
                var player2Move = player2Bot.MakeMove(player1, player2, null);

                var winnerBot = DetermineWinner(
                    new BotMove() {
                        Player = player1Bot,
                        Move = player1Move
                    },
                    new BotMove() {
                        Player = player2Bot,
                        Move = player2Move
                    });

                if (winnerBot == null)
                    tiePoints++;
                else
                {
                    TestPlayer winningPlayer = winnerBot == player1Bot ? player1 : player2;

                    winningPlayer.Points += 1 + tiePoints;
                    tiePoints = 0;
                }

                UpdatePlayerLastMove(player1, player1Move);
                UpdatePlayerLastMove(player2, player2Move);

                decisions++;
            }

            if (player1.Points == player2.Points)
                return null;
            else
                return player1.Points > player2.Points ? player1 : player2;
        }
        public void MyBotShouldWinAgainstRandomBotTest()
        {
            // Arrange
            var me = new TestPlayer();
            var randomPlayer = new TestPlayer();

            var myBot = new MyBot();
            var randomBot = new RandomBot();

            // Act
            var winner = new GameEmulator().PlayMatch(me, myBot, randomPlayer, randomBot);

            // Assert
            Assert.AreSame(me, winner);
        }
 private void UpdatePlayerLastMove(TestPlayer player, Move move)
 {
     player.LastMove = move;
 }
 private void InitializeTestPlayer(TestPlayer player)
 {
     player.Points = 0;
 }