Exemple #1
0
        public void pointWonBy(string playerName)
        {
            // find the player
            var player = getPlayer(playerName);

            // add one to their score
            player.GameScore.WonPoint();

            // has someone won. Oh the excitment?
            var player_GameWinner = _gameScoreCalculator.ChooseWinner(_player1, _player2);

            // If not null then the game was won. Increament the game count in the Set
            if (null != player_GameWinner)
            {
                _gameScoreCalculator = new GameScoreCalculator();
                _player1.GameScore.Reset();
                _player2.GameScore.Reset();
                player.SetScore.WonGame();
            }

            if (hasSetMovedToTieBreak())
            {
                _gameScoreCalculator  = new SetGameTieBreakScoreCalculator();
                _matchScoreCalculator = new MatchTieBreakerScoreCalculator();
            }
        }
Exemple #2
0
        public Match(string playerName1, string playerName2)
        {
            _player1 = new Player(playerName1);
            _player2 = new Player(playerName2);

            _setScoreCalculator   = new SetScoreCalculator();
            _gameScoreCalculator  = new GameScoreCalculator();
            _matchScoreCalculator = new MatchScoreCalculator();
        }