Initial commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using GameOfLife;
|
||||
using GameOfLife.Entities;
|
||||
using GameOfLife.IO;
|
||||
|
||||
namespace GameOfLifeTests
|
||||
{
|
||||
public class PatternTestData
|
||||
{
|
||||
public readonly string C0Text = "....." + Environment.NewLine +
|
||||
"..o.." + Environment.NewLine +
|
||||
"..oo." + Environment.NewLine +
|
||||
".....";
|
||||
|
||||
public Pattern CornerPattern;
|
||||
public Pattern CornerCopy;
|
||||
|
||||
public readonly string C2SquareText = "....." + Environment.NewLine +
|
||||
".oo.." + Environment.NewLine +
|
||||
".oo.." + Environment.NewLine +
|
||||
".....";
|
||||
|
||||
public Pattern SquarePattern;
|
||||
|
||||
public readonly string Glider = "...o." + Environment.NewLine +
|
||||
".o.o." + Environment.NewLine +
|
||||
"..oo." + Environment.NewLine +
|
||||
".....";
|
||||
|
||||
public Pattern GliderPattern;
|
||||
|
||||
public readonly string GliderApgcode = "xq4_153";
|
||||
|
||||
public Pattern GliderApgPattern;
|
||||
|
||||
public PatternTestData()
|
||||
{
|
||||
CornerPattern = Pattern.Extract(C0Text);
|
||||
CornerCopy = Pattern.Extract(C0Text);
|
||||
SquarePattern = Pattern.Extract(C2SquareText);
|
||||
GliderPattern = Pattern.Extract(Glider);
|
||||
var apgcodeDecoder = new ApgcodeDecoder(GliderApgcode);
|
||||
GliderApgPattern = apgcodeDecoder.Pattern;
|
||||
}
|
||||
|
||||
public static void ConsoleWrite(Pattern pattern)
|
||||
{
|
||||
foreach (var cell in pattern)
|
||||
{
|
||||
Console.WriteLine(cell);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConsoleWriteGrid(Pattern pattern)
|
||||
{
|
||||
var enumerable = pattern.ToGrid();
|
||||
|
||||
foreach (var e in enumerable)
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user