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


C# IAgent类代码示例

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


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

示例1: RunParameters

 public RunParameters(string exePath, string workingDirectory, string parameters, IAgent agent)
 {
     this.exePath = exePath;
     this.workingDirectory = workingDirectory;
     this.parameters = parameters;
     this.agent = agent;
 }
开发者ID:chrisforbes,项目名称:profiler,代码行数:7,代码来源:RunParameters.cs

示例2: User

        public User(IAgent agent)
        {
            this._Agent = agent;

            this._Updater = new Updater();
            this._User = new Remoting.User(this._Agent);
        }
开发者ID:jiowchern,项目名称:ItIsNotAGame1-Backend,代码行数:7,代码来源:User.cs

示例3: AddOneAgent

 //добавляем одного агента в общий каталог
 public static void AddOneAgent(IAgent agent)
 {
     lock (agentDictionary)
     {
         agentDictionary.Add(agent.GetId(), agent);
     }
 }
开发者ID:KseniiaKen,项目名称:MAS,代码行数:8,代码来源:GlobalAgentDescriptorTable.cs

示例4: Evaluate

 static double Evaluate(IAgent model, IAgent benchmark, GridGameParameters _params)
 {
     double score = 0;
     Console.WriteLine("Starting games as player 1..");
     for (int i = 0; i < _params.MatchesPerOpponent; i++)
     {
         var game = _params.GameFunction(model, benchmark);
         game.PlayToEnd();
         if (game.Winner == 1)
             score += _params.WinReward;
         else if (game.Winner == 0)
             score += _params.TieReward;
         else
             score += _params.LossReward;
     }
     Console.WriteLine("Starting games as player 2..");
     for (int i = 0; i < _params.MatchesPerOpponent; i++)
     {
         var game = _params.GameFunction(benchmark, model);
         game.PlayToEnd();
         if (game.Winner == -1)
             score += _params.WinReward;
         else if (game.Winner == 0)
             score += _params.TieReward;
         else
             score += _params.LossReward;
     }
     Console.WriteLine("Done!");
     return score;
 }
开发者ID:tansey,项目名称:grid-games,代码行数:30,代码来源:Program.cs

示例5: Wander

        /// <summary>
        /// Combines wandering and separation
        /// </summary>
        public static void Wander(IAgent agent, IAgent[] otherAgents, ref Steering.SteerParameters steerParams)
        {
            // add up the steering forces
            Vector3 wander = Steering.WanderForce(agent, ref steerParams);
            Vector3 separation = Vector3.Zero;
            Vector3 bounds = Steering.WorldBoundsForce(agent, steerParams);

            int avoiding = 0;
            for (int i = 0; i < otherAgents.Length; i++)
            {
                IAgent otherAgent = otherAgents[i];

                if (agent != otherAgent)
                {
                    float separationDistance = Vector3.Distance(agent.Position, otherAgent.Position);
                    if (separationDistance < steerParams.SeparationRange)
                    {
                        separation += Steering.SeparationForce(agent, otherAgent, steerParams, separationDistance);
                        avoiding++;
                    }
                }
            }

            agent.Direction = Vector3.Normalize(agent.Direction + wander + separation + bounds);
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:28,代码来源:Behaviors.cs

示例6: FindTargetTerms

        public override IEnumerable<Term> FindTargetTerms(IAgent agent, Func<Term, bool> predicate)
        {
            Func<Term, bool> whereClause = t => t.Level > 0 && t.Level < 3 && predicate(t);
            var results = agent.SelectTargetTerms(whereClause);

            return results;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:7,代码来源:EventBatchAlterModel.cs

示例7: SetAgent

        public void SetAgent(IAgent aAgent)
        {
            // detach existing agent
              if (mAgent != null) {
            if (mAgent is Agent) {
              var agent = mAgent as Agent;
              agent.KeyListChanged -= AgentKeyListChangeHandler;
              agent.Locked -= AgentLockHandler;
            }
              }

              mAgent = aAgent;

              if (mAgent is Agent) {
            var agent = mAgent as Agent;
            mKeyNodeView.Columns[0].Visible = true;
            mKeyNodeView.Columns[1].Visible = true;
            agent.KeyListChanged += AgentKeyListChangeHandler;
            agent.Locked += AgentLockHandler;
            //buttonTableLayoutPanel.Controls.Remove(refreshButton);
            //buttonTableLayoutPanel.ColumnCount = 5;
              } else {
            mKeyNodeView.Columns[0].Visible = false;
            mKeyNodeView.Columns[1].Visible = false;
            //buttonTableLayoutPanel.ColumnCount = 6;
            //buttonTableLayoutPanel.Controls.Add(refreshButton, 5, 0);
              }
              ReloadKeyListView();
        }
开发者ID:dlech,项目名称:SshAgentLib,代码行数:29,代码来源:KeyManagerWiget.cs

示例8: FindTargetTerms

        public override IEnumerable<Term> FindTargetTerms(IAgent agent, Func<Term, bool> predicate)
        {
            var results = agent.SelectTargetTerms(
                t => (t is Assignment || t is OvertimeAssignment) && predicate(t));

            return results;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:7,代码来源:AssignmentBatchAlterModel.cs

示例9: PerformGameBenchmarking

        static void PerformGameBenchmarking()
        {
            Dictionary<int, int> wins = new Dictionary<int, int>(4);

            for (int i = 0; i < 1000; i++)
            {
                var controller = new GameController();
                var agents = new IAgent[] { new StarterAgent(), new StarterAgent(), new StarterAgent() }; // new HumanAgent()
                int intWinner = controller.StartGame(agents, i, i, false, false);
                //var winner = agents[intWinner];

                if (wins.ContainsKey(intWinner))
                {
                    wins[intWinner] = wins[intWinner] + 1;
                }
                else
                {
                    wins.Add(intWinner, 1);
                }
                Console.WriteLine(i + ": P " + intWinner + " wins.");
            }

            Console.WriteLine();
            wins.OrderBy(w => w.Key).ForEach(kv => Console.WriteLine("Player " + kv.Key + ": " + kv.Value + " wins."));
        }
开发者ID:rasmusgreve,项目名称:catan,代码行数:25,代码来源:Program.cs

示例10: _ToGaming

 private void _ToGaming(IAgent agent)
 {
     var stage = new LocalGamingStage(agent, WorldPrefab, ControllerPrefab);
     stage.DoneEvent += _ToSetting;
     _DrawWindow = stage.DrawWindow;
     _Machine.Push(stage);
 }
开发者ID:jiowchern,项目名称:UnityRemotingSample,代码行数:7,代码来源:Local.cs

示例11: DeaWinService

        public DeaWinService(ILog log, IAgent agent)
        {
            this.log = log;
            this.agent = agent;

            agentTask = new Task(() => agent.Start());
            agentMonitorTimer = new Timer(agentMonitor);
        }
开发者ID:niemyjski,项目名称:ironfoundry,代码行数:8,代码来源:DeaWinService.cs

示例12: addAgent

    public void addAgent(IAgent a, System.String startLocation)
    {
		// Ensure the agent state information is tracked before
		// adding to super, as super will notify the registered
		// EnvironmentViews that is was added.
		state.setAgentLocationAndTravelDistance(a, startLocation, 0.0);
		base.addAgent(a);
	}
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:8,代码来源:MapEnvironment.cs

示例13: User

 public User(IAgent agent)
 {
     _Agent = agent;
     _ConnectProvider = new TProvider<IConnect>();
     _OnlineProvider = new TProvider<IOnline>();
     _Machine = new StageMachine();
     _Updater = new Updater();
 }
开发者ID:jiowchern,项目名称:Regulus,代码行数:8,代码来源:User.cs

示例14: SiteResourceDominance

        //---------------------------------------------------------------------
        ///<summary>
        ///Calculate the Site Resource Dominance (SRD) for all active sites.
        ///The SRD averages the resources for each species as defined in the
        ///BDA species table.
        ///SRD ranges from 0 - 1.
        ///</summary>
        //---------------------------------------------------------------------
        public static void SiteResourceDominance(IAgent agent, int ROS)
        {
            PlugIn.ModelCore.Log.WriteLine("   Calculating BDA Site Resource Dominance.");

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape) {

                double sumValue = 0.0;
                double maxValue = 0.0;
                int    ageOldestCohort= 0;
                int    numValidSpp = 0;
                double speciesHostValue = 0;

                foreach (ISpecies species in PlugIn.ModelCore.Species)
                {
                    ageOldestCohort = Util.GetMaxAge(SiteVars.Cohorts[site][species]);
                    ISppParameters sppParms = agent.SppParameters[species.Index];
                    if (sppParms == null)
                        continue;

                    bool negList = false;
                    foreach (ISpecies negSpp in agent.NegSppList)
                    {
                        if (species == negSpp)
                            negList = true;
                    }

                    if ((ageOldestCohort > 0) && (! negList))
                    {
                        numValidSpp++;
                        speciesHostValue = 0.0;

                        if (ageOldestCohort >= sppParms.MinorHostAge)
                            //speciesHostValue = 0.33;
                            speciesHostValue = sppParms.MinorHostSRD;

                        if (ageOldestCohort >= sppParms.SecondaryHostAge)
                            //speciesHostValue = 0.66;
                            speciesHostValue = sppParms.SecondaryHostSRD;

                        if (ageOldestCohort >= sppParms.PrimaryHostAge)
                            //speciesHostValue = 1.0;
                            speciesHostValue = sppParms.PrimaryHostSRD;


                        sumValue += speciesHostValue;
                        maxValue = System.Math.Max(maxValue, speciesHostValue);
                    }
                }

                if (agent.SRDmode == SRDmode.mean)
                    SiteVars.SiteResourceDom[site] = sumValue / (double) numValidSpp;

                if (agent.SRDmode == SRDmode.max)
                    SiteVars.SiteResourceDom[site] = maxValue;

            }

        }  //end siteResourceDom
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:66,代码来源:SiteResources.cs

示例15: Game

 public Game(IMapGenerator generator, IEnumerable<IAction> coreActions, IAgent agent)
 {
     _initialiseHooks = new List<IInitialiseHook>();
     _addedActions = new List<IAction>();
     _actionHooks = new Dictionary<string, List<IActionHook>>();
     _coreActions = coreActions;
     _generator = generator;
     Reset(agent);
 }
开发者ID:ThreeToes,项目名称:ExtensiWumpus,代码行数:9,代码来源:Game.cs


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