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


C# Mesh.Generate方法代码示例

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


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

示例1: Start

        public void Start()
        {
            Mesh = new Mesh();
            Mesh.Generate();

            foreach (var cs in Mesh.Self.CipherSets)
            {
                ConsoleWriteLine($"{cs.Key.ToString("x2")}: {Telehash.Base32Encoder.EncodeStripped(cs.Value.Keys.PublicKey)}");
            }
            ConsoleWriteLine("Hashname: " + Mesh.Hashname);

            var builder = new UriBuilder(Mesh.URI);
            builder.Host = "127.0.0.1";
            builder.Port = 8989;
            ConsoleWriteLine(builder.ToString());

            udp = new UDPTransport(new System.Net.IPEndPoint(System.Net.IPAddress.Any, 8989));
            udp.Listen(Mesh);
            Mesh.DebugLogEvent += new DebugLogHandler(OnDebugLog);
        }
开发者ID:lukedoolittle,项目名称:telehash.net,代码行数:20,代码来源:Chatter.cs

示例2: PerformProcessing

 private void PerformProcessing()
 {
     Mesh mesh = new Mesh(generateProfile.BoardWidth, generateProfile.BoardHeight, generateProfile.BoardStyle);
     mesh.SolverMethod = generateProfile.GeneratorStyle;
     mesh.IterativeSolverDepth = generateProfile.IterativeGeneratorDepth;
     mesh.ConsiderMultipleLoops = generateProfile.GenerateConsiderMultipleLoops;
     mesh.UseIntersectCellInteractsInSolver = generateProfile.GeneratorCellIntersInteract;
     mesh.Generate();
     Mesh end = mesh.FinalSolution;
     Connection.PostResponse(new GenerateResponse(mesh, end), MessageNumber);
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:11,代码来源:Connection.cs

示例3: GenerateNew

 private void GenerateNew(Mesh copy)
 {
     targetPruned = copy.Cells.Count;
     currentPruned = 0;
     OnGenerate(new ProgressEventArgs(currentPruned, targetPruned));
     copy.PrunedCountProgress += new EventHandler(copy_PrunedCountProgress);
     copy.Generate();
     OnGenerate(new ProgressEventArgs(targetPruned, targetPruned));
     this.Dispatcher.BeginInvoke(delegate()
     {
         this.Mesh = copy;
     });
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:13,代码来源:LoopDisplaySilverlight.cs

示例4: GenerateFirst

 private void GenerateFirst(Mesh mesh)
 {
     targetPrunedCount = mesh.Cells.Count;
     prunedCount = 0;
     Display_Generation(this, new ProgressEventArgs(prunedCount, targetPrunedCount));
     mesh.PrunedCountProgress += new EventHandler(mesh_PrunedCountProgress);
     mesh.Generate();
     Display_Generation(this, new ProgressEventArgs(targetPrunedCount, targetPrunedCount));
     this.Dispatcher.BeginInvoke(delegate() { Display.Mesh = mesh; });
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:10,代码来源:MainPage.xaml.cs

示例5: SelfTest

        private void SelfTest(int height, int width, MeshType meshType, bool extensive)
        {
            Output(string.Format("SelfTesting {0}, {1}, {2}, {3}", height, width, meshType, extensive));
            List<string> codes = new List<string>{"S", "SC", "SCO", "SCOM", "SC+OM", "SC+EOM", "SC+EOMP", "SC+EOMP+", "FC+EOMP+"};
            List<string> extraCodes = new List<string>{"SI", "SIC", "SIO", "SM", "SIM", "SOM", "SP", "SP+", "SC+EP", "SE", "SEP", "SC+E", "SCE", "SCP"};
            try
            {
                int solvedCount=0;
                for (int i = 0; i < (extensive ? 100 : 5); i++)
                {
                    Mesh m = new Mesh(width, height, meshType);
                    m.SetRatingCodeOptions("F");
                    m.GenerateBoringFraction = 0.5/height;
                    m.GenerateLengthFraction = 0.7;
                    m.Generate();
                    bool solved = false;
                    int lastDepth = int.MaxValue;
                    foreach (string code_in in codes)
                    {
                        bool solvedByCode = false;
                        for (int j = 0; j < (extensive ? height * height : 1); j++ )
                        {
                            string code = code_in;
                            if (extensive)
                                code += (j-1).ToString();
                            m.Clear();
                            m.SetRatingCodeOptions(code);
                            SolveState result = m.TrySolve();
                            if (result == SolveState.Solved)
                            {
                                solvedByCode = true;
                                if (!solved)
                                    solved = true;
                                if (extensive)
                                {
                                    if (j < lastDepth)
                                        lastDepth = j;
                                }
                            }
                            else
                            {
                                if (solved)
                                {
                                    if (!extensive || j > lastDepth || j == height*height-1)
                                    {
                                        Output(string.Format("Code {0} failed to solve puzzle solved with less powerful solvers.", code));
                                        using (TextWriter writer = File.CreateText("SelfTestOuput" + failCount + "-" + code + ".loop"))
                                        {
                                            m.Save(writer);
                                        }
                                    }
                                    failCount++;
                                }
                            }
                        }
                        if (solvedByCode)
                            solvedCount++;
                    }

                    m.FullClear();
                    m.SetRatingCodeOptions("S");
                    m.Generate();
                    foreach (string code in codes.Concat(extraCodes))
                    {
                        m.Clear();
                        m.SetRatingCodeOptions(code);
                        SolveState result = m.TrySolve();
                        if (result != SolveState.Solved)
                        {
                            Output(string.Format("Code {0} failed to solve puzzle generated with less powerful generator.", code));
                            using (TextWriter writer = File.CreateText("SelfTestOuput" + failCount + "-" + code + ".loop"))
                            {
                                m.Save(writer);
                            }
                            failCount++;
                        }
                    }
                }
                Output(string.Format("{0} codes solved {1} full generator puzzles {2} times.", codes.Count, extensive ? 100 : 5, solvedCount));
            }
            catch (Exception ex)
            {
                if (!(ex is ThreadAbortException))
                {
                    Output(string.Format("Failure {0}", ex));
                }
            }
        }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:88,代码来源:HelpForm.cs


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