|
using System;
using gameOfLife.Framework;
using gameOfLife.Transition;
namespace gameOfLife.Program
{
class Program
{
static void Main(string[] args)
{
string input = string.Empty;
ITransition[] transitions = new ITransition[] { new Loneliness(), new OverCrowding(), new NextGeneration(), new Spawn() };
while (!input.Equals("."))
{
input = Console.ReadLine();
if (input.Contains(","))
{
string[] xy = input.Split(',');
PatternOfCells.Instance.Cells.Add(new Cell(int.Parse(xy[0]), int.Parse(xy[1])));
}
else if (!input.Equals("."))
{
Console.WriteLine("Invalid input - Enter comma separated coordinates (x, y) and '.' to end");
}
}
PatternOfCells.Instance.ApplyTransitions(transitions);
foreach (var cell in PatternOfCells.Instance.Cells)
{
Console.WriteLine("{0},{1}", cell.X, cell.Y);
}
Console.Read();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
is a poor software developer and thinker. Presently working on a theory of "complementary perception". It's a work in progress.