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


C# Engine.Process方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Generation<SimpleCell> seedGeneration = new Generation<SimpleCell>(5, 5);
            //setup seed
            //Blinker (period 2) - Oscillator
            seedGeneration.Cells[2][1].IsAlive = true;
            seedGeneration.Cells[2][2].IsAlive = true;
            seedGeneration.Cells[2][3].IsAlive = true;

            //Toad
            //Generation<SimpleCell> seedGeneration = new Generation<SimpleCell>(6, 6);
            //seedGeneration.Cells[2][2].IsAlive = true;
            //seedGeneration.Cells[2][3].IsAlive = true;
            //seedGeneration.Cells[2][4].IsAlive = true;
            //seedGeneration.Cells[3][1].IsAlive = true;
            //seedGeneration.Cells[3][2].IsAlive = true;
            //seedGeneration.Cells[3][3].IsAlive = true;

            //Still Life - boat
            //Generation<SimpleCell> seedGeneration = new Generation<SimpleCell>(4, 4);
            //seedGeneration.Cells[1][1].IsAlive = true;
            //seedGeneration.Cells[1][2].IsAlive = true;
            //seedGeneration.Cells[2][1].IsAlive = true;
            //seedGeneration.Cells[2][2].IsAlive = true;

            Engine<SimpleCell> engine = new Engine<SimpleCell>(seedGeneration, maxGens);

            engine.Process(Display);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Done");
            Console.ReadLine();
        }
开发者ID:mohitbhatt,项目名称:GameOfLife,代码行数:33,代码来源:Program.cs

示例2: ProcessOscillatorTest

        public void ProcessOscillatorTest()
        {
            Generation<SimpleCell> seedGeneration = new Generation<SimpleCell>(5, 5);
            //setup seed
            //Blinker (period 2) - Oscillator
            seedGeneration.Cells[2][1].IsAlive = true;
            seedGeneration.Cells[2][2].IsAlive = true;
            seedGeneration.Cells[2][3].IsAlive = true;

            var engine = new Engine<SimpleCell>(seedGeneration, 2);
            engine.DontSleep = true;
            engine.Process(Help);

            Assert.AreEqual(3, _testRuns.Count);

            var run0 = _testRuns[0]; //this is the seed
            Assert.IsTrue(run0.Cells[2][1].IsAlive);
            Assert.IsTrue(run0.Cells[2][2].IsAlive);
            Assert.IsTrue(run0.Cells[2][3].IsAlive);

            var run1 = _testRuns[1];

            Assert.IsFalse(run1.Cells[0][0].IsAlive);
            Assert.IsFalse(run1.Cells[0][1].IsAlive);
            Assert.IsFalse(run1.Cells[0][2].IsAlive);
            Assert.IsFalse(run1.Cells[0][3].IsAlive);
            Assert.IsFalse(run1.Cells[0][4].IsAlive);

            Assert.IsFalse(run1.Cells[1][0].IsAlive);
            Assert.IsFalse(run1.Cells[1][1].IsAlive);
            Assert.IsTrue(run1.Cells[1][2].IsAlive);
            Assert.IsFalse(run1.Cells[1][3].IsAlive);
            Assert.IsFalse(run1.Cells[1][4].IsAlive);

            Assert.IsFalse(run1.Cells[2][0].IsAlive);
            Assert.IsFalse(run1.Cells[2][1].IsAlive);
            Assert.IsTrue(run1.Cells[2][2].IsAlive);
            Assert.IsFalse(run1.Cells[2][3].IsAlive);
            Assert.IsFalse(run1.Cells[2][4].IsAlive);

            Assert.IsFalse(run1.Cells[3][0].IsAlive);
            Assert.IsFalse(run1.Cells[3][1].IsAlive);
            Assert.IsTrue(run1.Cells[3][2].IsAlive);
            Assert.IsFalse(run1.Cells[3][3].IsAlive);
            Assert.IsFalse(run1.Cells[3][4].IsAlive);

            Assert.IsFalse(run1.Cells[4][0].IsAlive);
            Assert.IsFalse(run1.Cells[4][1].IsAlive);
            Assert.IsFalse(run1.Cells[4][2].IsAlive);
            Assert.IsFalse(run1.Cells[4][3].IsAlive);
            Assert.IsFalse(run1.Cells[4][4].IsAlive);

            var run2 = _testRuns[2]; //this is same as seed due to oscillation effect
            Assert.IsTrue(run2.Cells[2][1].IsAlive);
            Assert.IsTrue(run2.Cells[2][2].IsAlive);
            Assert.IsTrue(run2.Cells[2][3].IsAlive);

            //the asserts above are too verbose. In the next version, compact them to another method that can
            //assert bool values in an array and a list of indices
        }
开发者ID:mohitbhatt,项目名称:GameOfLife,代码行数:60,代码来源:EngineTests.cs

示例3: CanParseText

        public void CanParseText()
        {
            using (var engine = new Engine(@"./tessdata", "eng", EngineMode.Default)) {
                using(var img = Pix.LoadFromFile("./phototest.tiff")) {
                    using(var iter = engine.Process(img)) {
                        var paraText = iter.GetText(PageIteratorLevel.Para);
                        var blockText = iter.GetText(PageIteratorLevel.Block);
                        var lineText = iter.GetText(PageIteratorLevel.TextLine);
                        var wordText = iter.GetText(PageIteratorLevel.Word);
                        var symbol = iter.GetText(PageIteratorLevel.Symbol);

                    }
                }
            }
        }
开发者ID:mingdynasty,项目名称:tesseract,代码行数:15,代码来源:EngineTests.cs

示例4: ProcessThrowsExceptionOnSanityCheckFailure

 public void ProcessThrowsExceptionOnSanityCheckFailure()
 {
     var engine = new Engine<SimpleCell>(); //Current gen is just new, sanity will fail
     engine.Process(Help);
 }
开发者ID:mohitbhatt,项目名称:GameOfLife,代码行数:5,代码来源:EngineTests.cs


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