本文整理汇总了C#中NodeList.Where方法的典型用法代码示例。如果您正苦于以下问题:C# NodeList.Where方法的具体用法?C# NodeList.Where怎么用?C# NodeList.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeList
的用法示例。
在下文中一共展示了NodeList.Where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public void Build()
{
NodeList<BuildAction> roots = new NodeList<BuildAction>();
NodeList<BuildAction> allgames = new NodeList<BuildAction>();
foreach (var replay in m_replays)
{
foreach (var player in replay.Players)
{
var actions = replay.Actions.Where(x => x.Player == player
&& x.ActionType == Entities.ActionType.Build)
.OrderBy(y => y.Sequence)
.Cast<BuildAction>();
if (actions.Count() > 0)
{
BuildAction action = actions.ElementAt(0);
Node<BuildAction> node = new Node<BuildAction>(1, action, buildTree(actions));
allgames.Add(node);
if (roots.Where(x => x.Value.ObjectType == action.ObjectType).Count() == 0)
{
roots.Add(node);
}
}
}
}
countOccurances(roots, allgames);
m_roots = roots;
m_allGames = allgames;
}
示例2: initialCentroidReasonable
private List<Centroid> initialCentroidReasonable(NodeList<BuildAction> observations)
{
List<Centroid> centroids = new List<Centroid>();
// We know there are 6 possible openers in Starcraft (based on datamining).
// Use these as centroids
centroids.Add(new Centroid(observations.Where(x => x.Value.ObjectType == Entities.ObjectType.Pylon).First()));
centroids.Add(new Centroid(observations.Where(x => x.Value.ObjectType == Entities.ObjectType.Extractor).First()));
centroids.Add(new Centroid(observations.Where(x => x.Value.ObjectType == Entities.ObjectType.SpawningPool).First()));
centroids.Add(new Centroid(observations.Where(x => x.Value.ObjectType == Entities.ObjectType.Hatchery).First()));
centroids.Add(new Centroid(observations.Where(x => x.Value.ObjectType == Entities.ObjectType.Barracks).First()));
centroids.Add(new Centroid(observations.Where(x => x.Value.ObjectType == Entities.ObjectType.SupplyDepot).First()));
return centroids;
}