示例#1
0
 public void LoadStrategy(AbstractStrategy s)
 {
     //s.SetAccountManager(_accountManager);
     s.IsLive = false;
     _strategies.Add(s);
     Console.WriteLine("Loaded" + s.ToString());
 }
示例#2
0
        public Table(int id, int size, AbstractStrategy strategy, AbstractOutput output)
        {
            this.Id    = id;
            this.Size  = size;
            this.Seats = new List <AbstractSeat>();
            this.Board = new List <Card>();
            this.Board.Clear();

            AbstractSeat prevSeat = new EmptySeat(this, null, null);

            for (int i = 1; i < this.Size; i++)
            {
                this.Seats.Add(prevSeat);
                prevSeat = new EmptySeat(this, null, prevSeat);
            }
            this.Seats.Add(prevSeat);

            this.Seats[0].Right = prevSeat;

            while (prevSeat.Right.Left == null)
            {
                prevSeat.Right.Left = prevSeat;
                prevSeat            = prevSeat.Right;
            }

            this.SitIn(0, new ArtificialPlayer(strategy, output));
        }
示例#3
0
 public override void changeStrategy(AbstractStrategy strategy)
 {
     StrategysType currentStrategyType = _currentStrategy.getStrategyType ();
     if (currentStrategyType == StrategysType.MOVE) {
         _creature.agent.Stop();
     };
     base.changeStrategy (strategy);
 }
 //прерывание и смена состояния
 public virtual void changeStrategy(StrategysType strategyType)
 {
     if (_allStrategy.ContainsKey(strategyType)) {
         _currentStrategy = _allStrategy[strategyType];
         _currentStrategy.onStartState(_target);
         _target = _currentStrategy.target;
     }
 }
示例#5
0
 public Player(PlayerConfig playerConfig, IGameService gameService, IMessageProvider messageProvider, PlayerState playerState, IActionExecutor actionExecutor, AbstractStrategy strategy)
 {
     _gameService     = gameService;
     _messageProvider = messageProvider;
     _playerConfig    = playerConfig;
     _playerState     = playerState;
     _actionExecutor  = actionExecutor;
     _strategy        = strategy;
 }
    public void addState(AbstractStrategy strategy, bool mainState = false)
    {
        if (mainState == null)
            mainState = false;
        _allStrategy.Add (strategy.getStrategyType(), strategy);

        if (mainState) {
            _currentStrategy = strategy;
            _currentStrategy.onStartState(_target);
            _target = _currentStrategy.target;
        }
    }
示例#7
0
 public Server(List<AbstractStrategy> strategies)
 {
     if (strategies.Count == 0)
     {
         throw new Exception("strategies must have at lease 1 strategy in it.");
     }
     foreach (var strategy in strategies)
     {
         strategy.SetServer(this);
         this.strategies[strategy.GetType()] = strategy;
     }
     currentStrategy = strategies[0];
 }
示例#8
0
 public StrategyContext(AbstractStrategy strategy)
 {
     _strategy = strategy;
 }
示例#9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="strategyType">Must be subclass of Server.AbstractStrategy</param>
 /// <returns></returns>
 public bool UseStrategy(Type strategyType)
 {
     if (!strategyType.IsSubclassOf(typeof(AbstractStrategy)))
     {
         return false;
     }
     if (!strategies.ContainsKey(strategyType))
     {
         return false;
     }
     currentStrategy = strategies[strategyType];
     return true;
 }
示例#10
0
 public void LoadStrategy(AbstractStrategy s)
 {
     s.SetAccountManager(_accountManager);
     s.IsLive = true;
     _strategies.Add(s);
 }
示例#11
0
 public Player(AbstractStrategy strategy, string name) : base(strategy)
 {
     this.name = name;
 }
示例#12
0
 public Context(AbstractStrategy strategy)
 {
     this.strategy = strategy;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreditSalesContext"/> class.
 /// </summary>
 /// <param name="creditStrategy">
 /// The credit strategy.
 /// </param>
 public CreditSalesContext(AbstractStrategy creditStrategy)
 {
     this.Strategy = creditStrategy;
 }
示例#14
0
 public SortedList(List <int> numbers, AbstractStrategy strategy)
 {
     _numbers         = numbers;
     _currentStrategy = strategy;
 }
示例#15
0
 public void SetStrategy(InputType type)
 {
     currentStrategy = strategiesList.FirstOrDefault(s => s.inputType == type);
 }
示例#16
0
 //прерывание и смена состояния
 public virtual void changeStrategy(AbstractStrategy startegy)
 {
     _currentStrategy = startegy;
     _currentStrategy.onStartState(_target);
     _target = _currentStrategy.target;
 }
示例#17
0
 protected Participant(AbstractStrategy strategy)
 {
     this.strategy = strategy;
 }
示例#18
0
 public ArtificialPlayer(AbstractStrategy strategy, AbstractOutput output)
 {
     this.strategy = strategy;
     this.output   = output;
 }