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); }
public void GoLModelTest8() { /* **. **. **. * *.. --> **. --> **. --> stable * ... ... ... * */ // Checks the reference of the singleton DeadState GoLModel model = new GoLModel(); model.SetCell(false, 0, 0); model.SetCell(false, 0, 1); model.SetCell(false, 1, 0); Assert.AreEqual(model.Cells[0, 0].State.GetHashCode(), model.Cells[0, 1].State.GetHashCode()); }