本文整理汇总了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;
}
示例2: User
public User(IAgent agent)
{
this._Agent = agent;
this._Updater = new Updater();
this._User = new Remoting.User(this._Agent);
}
示例3: AddOneAgent
//добавляем одного агента в общий каталог
public static void AddOneAgent(IAgent agent)
{
lock (agentDictionary)
{
agentDictionary.Add(agent.GetId(), agent);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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."));
}
示例10: _ToGaming
private void _ToGaming(IAgent agent)
{
var stage = new LocalGamingStage(agent, WorldPrefab, ControllerPrefab);
stage.DoneEvent += _ToSetting;
_DrawWindow = stage.DrawWindow;
_Machine.Push(stage);
}
示例11: DeaWinService
public DeaWinService(ILog log, IAgent agent)
{
this.log = log;
this.agent = agent;
agentTask = new Task(() => agent.Start());
agentMonitorTimer = new Timer(agentMonitor);
}
示例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);
}
示例13: User
public User(IAgent agent)
{
_Agent = agent;
_ConnectProvider = new TProvider<IConnect>();
_OnlineProvider = new TProvider<IOnline>();
_Machine = new StageMachine();
_Updater = new Updater();
}
示例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
示例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);
}