Пример #1
0
        private PlayerAction GetTurnChain(PlayerTurnContext context)
        {
            var decisionContext = new DecisionMakingContext()
            {
                ActionChoser = ActionChoser,
                CardChoser   = CardChoser,
                MyCards      = this.Cards,
                Tracker      = Tracker,
                TurnContext  = context,
                Validator    = this.PlayerActionValidator
            };

            // TODO: this of something more elegant
            var action = decisionMaker.Handle(decisionContext);

            switch (action.Type)
            {
            case PlayerActionType.PlayCard:
                return(this.PlayCard(action.Card));

            case PlayerActionType.ChangeTrump:
                return(this.ChangeTrump(context.TrumpCard));

            case PlayerActionType.CloseGame:
                return(this.CloseGame());

            default:
                throw new InvalidOperationException("Invalid type of player action");
            }
        }
Пример #2
0
 public void Dispose()
 {
     if (_dmContext != null)
     {
         _dmContext.Dispose();
         _dmContext = null;
     }
 }
Пример #3
0
 public ModelingEstimator(OpponentModeling oppModelling, PokerClient pokerClient)
 {
     _opponentModeling = oppModelling;
     _pokerClient      = pokerClient;
     _dmContext        = new DecisionMakingContext();
 }