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


C# SearchResult.GetValue方法代码示例

本文整理汇总了C#中SearchResult.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# SearchResult.GetValue方法的具体用法?C# SearchResult.GetValue怎么用?C# SearchResult.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchResult的用法示例。


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

示例1: ParseResult

        private List<string> ParseResult(SearchResult searchResult)
        {
            List<string> results = new List<string>();
            string rawData = searchResult.SegmentedRaw.Value;

            //DateTime time = DateTime.Parse(searchResult["_time"]);
            //string format = "yyyy/M/d hh:mm:ss.fff";
            //results.Add(string.Format("{0}-{1}", ++eventCount, time.ToString(format)));

            string time = searchResult.GetValue("_time");
            time = time.Replace("Pacific Summer Time", "PST");
            results.Add(string.Format("{0}", time));

            rawData = rawData.Trim();
            //remove <v xml:space="preserve" trunc="0">
            if (rawData.StartsWith("<v xml:space="))
            {
                rawData = rawData.Remove(0, 34);
            }

            //remove </v>
            if (rawData.EndsWith("</v>"))
            {
                rawData = rawData.Substring(0, rawData.Length - 4);
            }

            results.Add(rawData);

            return results;
        }
开发者ID:nagyist,项目名称:splunk-sdk-csharp-pcl,代码行数:30,代码来源:SearchPage.xaml.cs

示例2: Negamax


//.........这里部分代码省略.........
            {
                // If the state has been visited, then return immediately or
                // improve the alpha and beta values depending on the node type.
                tableLookups++;

                // The score is stored in bits 8 to 15 of the entry.
                int encoded = (int)(((entry >> 8) & 0xFF) - 128);
                SearchResult lookupResult = new SearchResult { score = encoded };

                // The type is stored in bits 6 to 7 of the entry.
                int entryType = (int)((entry >> 6) & 0x3);
                
                // Flip the best move if necessary.
                entryBestMove = (int)((entry >> 16) & 0x7);
                if (usingFlippedPosition)
                {
                    entryBestMove = 6 - entryBestMove;
                }

                switch (entryType)
                {
                    // If the score is exact, there is no need to check anything
                    // else, so return the score of the entry.
                    case NodeTypeExact:
                        if (currentDepth == moveNumber)
                        {
                            finalMove = entryBestMove;
                        }
                        return lookupResult;

                    // If the entry score is an upper bound on the actual score,
                    // see if the current upper bound can be reduced.
                    case NodeTypeUpper:
                        beta = Math.Min(beta, lookupResult.GetValue());
                        break;

                    // If the entry score is a lower bound on the actual score,
                    // see if the current lower bound can be increased.
                    case NodeTypeLower:
                        alpha = Math.Max(alpha, lookupResult.GetValue());
                        break;
                }

                // At this point alpha or beta may have been improved, so check if
                // this is a cuttoff.
                if (alpha >= beta)
                {
                    alphaBetaCutoffs++;

                    if (currentDepth == moveNumber)
                    {
                        finalMove = entryBestMove;
                    }

                    return lookupResult;
                }
            }

            // A bitmap where a 1 means the corresponding move has already been
            // checked. Initialised with a 1 at all invalid moves.
            ulong checkedMoves = state.GetInvalidMovesMask();

            SearchResult result = new SearchResult { score = int.MinValue };

            int bestMove = -1;
            int index = -1;
开发者ID:ChristopheSteininger,项目名称:Connect4,代码行数:67,代码来源:AIPlayer.cs


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