public Form1() { InitializeComponent(); timer1.Interval = 500; _currentBoard = new Board(0, 0); _gameOL = new GameOfLife(); }
static void Main(string[] args) { /* * Very, very simple tester. Mostly for the sake of visualization. * */ Console.WriteLine("==================="); LifeGrid grid = new LifeGrid(new char[,] { { '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '*', '.', '.', '.' }, { '.', '.', '.', '*', '*', '.', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' } }); GameOfLife test = new GameOfLife(grid); test.printGrid(); test.produceNextGeneration(); test.printGrid(); Console.WriteLine("==================="); grid = new LifeGrid(new char[,] { { '*', '.', '.', '.' }, { '.', '.', '.', '.' }, { '.', '*', '.', '.' }, { '.', '.', '.', '.' } }) ; test.GameGrid = grid; test.printGrid(); test.produceNextGeneration(); test.printGrid(); Console.WriteLine("==================="); grid = new LifeGrid(new char[,] { { '*', '*', '.', '.' , '.' }, { '.', '.', '.', '.' , '.' }, { '.', '*', '.', '.' , '.' } }); test.GameGrid = grid; test.printGrid(); test.produceNextGeneration(); test.printGrid(); }
public void TestOutput1() { // Test input and output as given in task text GameOfLife localSut = new GameOfLife(new LifeGrid(new char[,] { { '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '*', '.', '.', '.' }, { '.', '.', '.', '*', '*', '.', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' } })); LifeGrid expectedResult = new LifeGrid( new char[,] { { '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '*', '*', '.', '.', '.' }, { '.', '.', '.', '*', '*', '.', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' } }); localSut.produceNextGeneration(); Assert.IsTrue(localSut.GameGrid.compareGrid(expectedResult)); }
public void setupTest() { target = new GameOfLife(); }
public void ICanGetTheLoadedBoard() { var target = new GameOfLife(); target.Load(kataBoardWith4RowsOf8Columns); Assert.AreEqual(kataBoardWith4RowsOf8Columns, target.Board); }
public Form1(GameOfLife gol) { _gol = gol; InitializeComponent(); }
public void TestOutput2() { // Testing a few more patterns and expected results i found on the intertube. GameOfLife localSut = new GameOfLife(new LifeGrid(new char[,] { { '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '*', '.', '.', '.', '.', '.', '.' }, { '*', '*', '*', '.', '.', '.', '.', '.' }, { '.', '*', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '*', '*', '.', '.' }, { '.', '.', '.', '.', '*', '*', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' } })); LifeGrid expectedResult = new LifeGrid( new char[,] { { '.', '.', '.', '.', '.', '.', '.', '.' }, { '*', '*', '*', '.', '.', '.', '.', '.' }, { '*', '.', '*', '.', '.', '.', '.', '.' }, { '*', '*', '*', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '*', '*', '.', '.' }, { '.', '.', '.', '.', '*', '*', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.' } }); localSut.produceNextGeneration(); Assert.IsTrue(localSut.GameGrid.compareGrid(expectedResult)); }