Exemplo n.º 1
0
        public int Play(IMatchParameters matchParameters)
        {
            if (matchParameters == null)
            {
                throw new ArgumentNullException(nameof(matchParameters));
            }

            while (true)
            {
                GameOutcome result = null;

                switch (matchParameters.GetRandomScorer())
                {
                case 1:
                    result = _score.UpdateScore(_player1Id);
                    break;

                case 2:
                    result = _score.UpdateScore(_player2Id);
                    break;

                default:
                    throw new InvalidOperationException("Invalid scorer.");
                }

                if (result != null)
                {
                    return(result.GetWinner());
                }
            }
        }
 public MatchParametersMF(IMatchParameters matchParams)
 {
     // initialize search parameters from method calls
     hrange = matchParams.horizontalRange();
 }
Exemplo n.º 3
0
 public Match(IMatchParameters matchParameters)
 {
     _matchParameters = matchParameters ?? throw new ArgumentNullException(nameof(matchParameters));
     _playedSets      = matchParameters.InitialiseMatchSets();
 }