예제 #1
0
 public void TestNumErrors()
 {
     Grid g = new Grid(9, 0);
     Assert.AreEqual(0, g.GetNumMistakes());
     g.Place(3,1,1);
     g.Place(3,0,1);
     Assert.AreEqual(2, g.GetNumMistakes());
     g.Place(0, 0, 1);
     Assert.AreEqual(0, g.GetNumMistakes());
 }
예제 #2
0
 public void TestGeneration()
 {
     Grid g = new Grid(9,10);
     Assert.AreEqual(0,g.GetNumMistakes());
     Assert.AreEqual(10,g.GetNumPlaced());
 }
 public double GetFitness(Grid g)
 {
     return g.GetNumMistakes()*MistakesFactor + g.GetEmptyPositions().Count;
 }