Exemple #1
0
        public GameOutcome GetGameResult(MoveOptions playerChoice, MoveOptions opponentChoice)
        {
            MoveOptionsPair figurePair = new MoveOptionsPair(playerChoice, opponentChoice);
            bool            isSuccess  = _gameResults.TryGetValue(figurePair, out GameOutcome result);

            if (isSuccess)
            {
                _logger.LogInformation($"{nameof(GameService)}: Game result calculated");
                return(result);
            }
            _logger.LogError($"{nameof(GameService)}: Invalid pair of figures");

            throw new ServiceException("Invalid pair of figures");
        }
Exemple #2
0
 public bool Equals(MoveOptionsPair obj)
 {
     return(obj != null && obj._moveOption1 == this._moveOption1 && obj._moveOption2 == this._moveOption2);
 }