当前位置: 首页>>代码示例>>C#>>正文


C# IStrategy类代码示例

本文整理汇总了C#中IStrategy的典型用法代码示例。如果您正苦于以下问题:C# IStrategy类的具体用法?C# IStrategy怎么用?C# IStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IStrategy类属于命名空间,在下文中一共展示了IStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformSimulation

        public SeasonSimulationResult PerformSimulation(IStrategy strategy, SeasonSimulationOptions options)
        {
            if (strategy == null) throw new ArgumentNullException("strategy");

            var allPlayers = GetPlayersForFirstGameweek();

            var maxGameweek = CalculateMaxGameweek(options.MaximumGameweek);

            _logger.Log(Tag.Simulation, string.Concat("Max gameweek is ", maxGameweek));

            var startingTeam = options.UseSavedInitialTeam ? SelectInitialTeamByIds(allPlayers, options.InitialTeamPlayerIds) : strategy.PickStartingTeam(allPlayers);

            _logger.Log(Tag.Simulation, "Starting team picked");
            LogHelper.LogTeam(startingTeam, _logger);

            if (options.ChooseInitialTeamOnly)
            {
                return new SeasonSimulationResult();
            }

            var seasonState = _decisionActioner.ValidateAndApplyStartingTeam(startingTeam, allPlayers);

            _logger.Log(Tag.Simulation, "Applied starting team");

            return SimulateSeason(seasonState, strategy, maxGameweek);
        }
开发者ID:robinweston,项目名称:fantasyfootballrobot,代码行数:26,代码来源:SeasonSimulator.cs

示例2: QuoteProvider

 public QuoteProvider(IStrategy owner)
 {
     _owner = owner;
     _lastPeek = new DateTime(1900, 1, 1);
     _timer = new Timer(1000);
     _timer.Elapsed += new ElapsedEventHandler(OnTick);
 }
开发者ID:bra5047,项目名称:psugv-500-team4,代码行数:7,代码来源:QuoteProvider.cs

示例3: run

        public void run()
        {
            try
            {
                remoteProcessClient.WriteToken(token);
                int teamSize = remoteProcessClient.ReadTeamSize();
                remoteProcessClient.WriteProtocolVersion();
                Game game = remoteProcessClient.readGameContext();

                IStrategy[] strategies = new IStrategy[teamSize];

                for (int strategyIndex = 0; strategyIndex < teamSize; ++strategyIndex)
                {
                    strategies[strategyIndex] = new MyStrategy();
                }

                PlayerContext playerContext;

                while ((playerContext = remoteProcessClient.ReadPlayerContext()) != null)
                {
                    Trooper playerTrooper = playerContext.Trooper;

                    Move move = new Move();
                    strategies[playerTrooper.TeammateIndex].Move(playerTrooper, playerContext.World, game, move);
                    remoteProcessClient.WriteMove(move);
                }
            }
            finally
            {
                remoteProcessClient.Close();
            }
        }
开发者ID:Evander83,项目名称:AICup-2013,代码行数:32,代码来源:Runner.cs

示例4: AddStock

 /// <summary>
 /// 增加一个策略,和关注的股票价格
 /// </summary>
 /// <param name="code">股票代码</param>
 /// <param name="strategy">策略实例</param>
 public void AddStock(String code, IStrategy strategy)
 {
     if (stockDataCache[code] == null)
     {
         stockDataCache[code] = new StockDataQueue();
     }
     stockDataCache[code].OnStockDataChange += strategy.OnStockDataChanged;
 }
开发者ID:lzyeasyboy,项目名称:StockTrader,代码行数:13,代码来源:StockMarketManager.cs

示例5: Template

 public Template(IStrategy strategy, String templateText, String[] namespaces,
                 params Variable[] variables)
 {
     _strategy = strategy;
     this.templateText = templateText;
     this.namespaces = namespaces;
     this.variables = variables;
 }
开发者ID:oleguchok,项目名称:Template-Performer-Client-Server,代码行数:8,代码来源:Template.cs

示例6: StrategyControl

        public StrategyControl(IStrategy strategy)
        {
            InitializeComponent();
            this.strategy = strategy;

            // load my stock pool
            LoadMyStockPool();
        }
开发者ID:GhostCamel,项目名称:StockTrader,代码行数:8,代码来源:StrategyControl.cs

示例7: BuildConfigurationContext

        public ConfigurationContext BuildConfigurationContext(BaseFeature feature, IStrategy strategy)
        {
            if (string.IsNullOrWhiteSpace(Key))
            {
                throw new ArgumentException("Missing 'Key' parameter for '" + strategy.GetType().Name + "' strategy for '" + feature.Name + "' feature");
            }

            return new ConfigurationContext(this);
        }
开发者ID:valdisiljuconoks,项目名称:FeatureSwitch,代码行数:9,代码来源:FeatureStrategyAttribute.cs

示例8: ComplexStrategy

 public ComplexStrategy(IStrategy[] innerStrategies, string name, long quantity,
                        IStrategy defaultStrategy, StrategyType strategyType)
 {
     _innerStrategies = innerStrategies;
     _name = name;
     _quantity = quantity;
     _defaultStrategy = defaultStrategy;
     _strategyType = strategyType;
 }
开发者ID:slahn,项目名称:structuremap,代码行数:9,代码来源:Strategy.cs

示例9: GuardianAgentSession

 public GuardianAgentSession(Agent agent, string process,
     IStrategy redStrategy, IStrategy yellowStrategy, double e1, double e2)
 {
     this.Agent = agent;
     this.TargetProcess = process;
     this.RedStrategy = redStrategy;
     this.YellowStrategy = yellowStrategy;
     this.E1 = e1;
     this.E2 = e2;
 }
开发者ID:Evlikat,项目名称:incinerate,代码行数:10,代码来源:GuardianAgentsPool.cs

示例10: ReachabilityStrategyCalculationAlgorithm

 public ReachabilityStrategyCalculationAlgorithm(ITestGraph testGraph, IStrategy strategy)
 {
     if (this.testGraph == null)
     {
         throw new ArgumentNullException("testGraph");
     }
     this.testGraph = testGraph;
     this.strategy = new QuickGraph.Algorithms.TestGames.Strategy();
     this.performanceComparer = new PairPreOrderPerformanceComparer();
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:10,代码来源:ReachabilityStrategyCalculationAlgorithm.cs

示例11: FoxWatchMainController

        public FoxWatchMainController(IStrategy strategy, DBOutEnum dbOutEnum)
        {
            _strategy = strategy;

            Boolean bDBOut_InRunning = false;
            if (dbOutEnum == DBOutEnum.Enable)
            {
                bDBOut_InRunning = true;
            }
            _foxCaptureController = new FoxWatchCaptureController(bDBOut_InRunning);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:11,代码来源:FoxWatchMainController.cs

示例12: RecognizedAgent

 public RecognizedAgent(string name, double res,
     IStrategy redStrategy, IStrategy yellowStrategy,
     double p1, double p2)
 {
     Name = name;
     m_P1 = p1;
     m_P2 = p2;
     m_Res = res;
     m_RedStrategy = redStrategy;
     m_YellowStrategy = yellowStrategy;
 }
开发者ID:Evlikat,项目名称:incinerate,代码行数:11,代码来源:WatchingAgentPool.cs

示例13: RegisterStrategy

 /// <summary>
 /// 在行情市场中登记一个策略,当关注股票价格发生变动的时候,即时提醒策略。
 /// </summary>
 /// <param name="strategy">策略实例</param>
 public void RegisterStrategy(IStrategy strategy)
 {
     foreach (string code in strategy.StockPool)
     {
         if (!StockMarketManager.bidCache.ContainsKey(code))
         {
             StockMarketManager.bidCache.Add(code, new BidCacheQueue());
         }
         StockMarketManager.bidCache[code].OnBidChange += strategy.OnStockDataChanged;
     }
 }
开发者ID:huoxudong125,项目名称:StockTrader,代码行数:15,代码来源:StockMarketManager.cs

示例14: ProcessStrategy

        private void ProcessStrategy(IStrategy strategy)
        {
            foreach (var quote in this.quotes)
            {
                strategy.ProcessQuote(quote);
            }

            if (Interlocked.Decrement(ref numberOfTasks) == 0)
            {
                signal.Set();
            }
        }
开发者ID:WinnieThePoooh,项目名称:Trading,代码行数:12,代码来源:BackTesting.cs

示例15: SwitchStrategy

 // Changing strategies
 public void SwitchStrategy()
 {
     if (strategy is Strategy1)
         strategy = new Strategy2();
     else
         strategy = new Strategy1();
 }
开发者ID:david--liu,项目名称:code_kata,代码行数:8,代码来源:StrategyPattern.cs


注:本文中的IStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。