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


C# NodeList.Where方法代码示例

本文整理汇总了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;
        }
开发者ID:Excolo,项目名称:SCReplayFileParser,代码行数:31,代码来源:TreeBuilder.cs

示例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;
        }
开发者ID:Excolo,项目名称:SCReplayFileParser,代码行数:15,代码来源:Kmeans.cs


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