public void GoLModelTest6() { /* cells on the first row */ /* *** .*. * ... --> .*. --> empty * ... ... * */ GoLModel model = new GoLModel(); model.SetCell(true, 0, 0); model.SetCell(true, 1, 0); model.SetCell(true, 2, 0); Assert.AreEqual(true, model.Cells[0, 0].IsAlive); Assert.AreEqual(false, model.Cells[0, 1].IsAlive); Assert.AreEqual(false, model.Cells[0, 2].IsAlive); Assert.AreEqual(true, model.Cells[1, 0].IsAlive); Assert.AreEqual(false, model.Cells[1, 1].IsAlive); Assert.AreEqual(false, model.Cells[1, 2].IsAlive); Assert.AreEqual(true, model.Cells[2, 0].IsAlive); Assert.AreEqual(false, model.Cells[2, 1].IsAlive); Assert.AreEqual(false, model.Cells[2, 2].IsAlive); model.BuildNextGeneration(); Assert.AreEqual(false, model.Cells[0, 0].IsAlive); Assert.AreEqual(false, model.Cells[0, 1].IsAlive); Assert.AreEqual(false, model.Cells[0, 2].IsAlive); Assert.AreEqual(true, model.Cells[1, 0].IsAlive); Assert.AreEqual(true, model.Cells[1, 1].IsAlive); Assert.AreEqual(false, model.Cells[1, 2].IsAlive); Assert.AreEqual(false, model.Cells[2, 0].IsAlive); Assert.AreEqual(false, model.Cells[2, 1].IsAlive); Assert.AreEqual(false, model.Cells[2, 2].IsAlive); model.BuildNextGeneration(); Assert.AreEqual(false, model.Cells[0, 0].IsAlive); Assert.AreEqual(false, model.Cells[0, 1].IsAlive); Assert.AreEqual(false, model.Cells[0, 2].IsAlive); Assert.AreEqual(false, model.Cells[1, 0].IsAlive); Assert.AreEqual(false, model.Cells[1, 1].IsAlive); Assert.AreEqual(false, model.Cells[1, 2].IsAlive); Assert.AreEqual(false, model.Cells[2, 0].IsAlive); Assert.AreEqual(false, model.Cells[2, 1].IsAlive); Assert.AreEqual(false, model.Cells[2, 2].IsAlive); }
public void GoLModelTest2() { /* .*. ... .*. * .*. --> *** --> .*. --> repeat * .*. ... .*. * */ GoLModel model = new GoLModel(); model.SetCell(true, 1, 0); model.SetCell(true, 1, 1); model.SetCell(true, 1, 2); Assert.AreEqual(false, model.Cells[0, 0].IsAlive); Assert.AreEqual(false, model.Cells[0, 1].IsAlive); Assert.AreEqual(false, model.Cells[0, 2].IsAlive); Assert.AreEqual(true, model.Cells[1, 0].IsAlive); Assert.AreEqual(true, model.Cells[1, 1].IsAlive); Assert.AreEqual(true, model.Cells[1, 2].IsAlive); Assert.AreEqual(false, model.Cells[2, 0].IsAlive); Assert.AreEqual(false, model.Cells[2, 1].IsAlive); Assert.AreEqual(false, model.Cells[2, 2].IsAlive); model.BuildNextGeneration(); Assert.AreEqual(false, model.Cells[0, 0].IsAlive); Assert.AreEqual(true, model.Cells[0, 1].IsAlive); Assert.AreEqual(false, model.Cells[0, 2].IsAlive); Assert.AreEqual(false, model.Cells[1, 0].IsAlive); Assert.AreEqual(true, model.Cells[1, 1].IsAlive); Assert.AreEqual(false, model.Cells[1, 2].IsAlive); Assert.AreEqual(false, model.Cells[2, 0].IsAlive); Assert.AreEqual(true, model.Cells[2, 1].IsAlive); Assert.AreEqual(false, model.Cells[2, 2].IsAlive); model.BuildNextGeneration(); Assert.AreEqual(false, model.Cells[0, 0].IsAlive); Assert.AreEqual(false, model.Cells[0, 1].IsAlive); Assert.AreEqual(false, model.Cells[0, 2].IsAlive); Assert.AreEqual(true, model.Cells[1, 0].IsAlive); Assert.AreEqual(true, model.Cells[1, 1].IsAlive); Assert.AreEqual(true, model.Cells[1, 2].IsAlive); Assert.AreEqual(false, model.Cells[2, 0].IsAlive); Assert.AreEqual(false, model.Cells[2, 1].IsAlive); Assert.AreEqual(false, model.Cells[2, 2].IsAlive); }