本文整理汇总了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();
}
示例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
}
示例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);
}
}
}
}
示例4: ProcessThrowsExceptionOnSanityCheckFailure
public void ProcessThrowsExceptionOnSanityCheckFailure()
{
var engine = new Engine<SimpleCell>(); //Current gen is just new, sanity will fail
engine.Process(Help);
}