private void TestGetHighestY(string gridString, int expectedY) { var grid = GridTests.CreateGrid(gridString, 0).ToIntArray(); var h = new AIHeuristic(); Assert.AreEqual(expectedY, h.GetHighest(grid).y); }
public void TestInternalFunctions() { TestGetHighestY("1 1 1 0", 0); TestGetHighestY("2 0 2 0\n1 1 1 0", 1); TestGetHighestY("2 0 0 0\n1 0 0 0\n1 0 0 0\n2 0 0 0", 3); TestGetHighestY("0 0 0 0\n2 0 2 0\n1 1 1 0", 1); var h = new AIHeuristic(); Assert.IsTrue(h.IsSameCombo(1, 1)); Assert.IsFalse(h.IsSameCombo(0, 0)); Assert.IsFalse(h.IsSameCombo(1, 2)); Assert.IsFalse(h.IsSameCombo(0, 1)); Assert.IsFalse(h.IsSameCombo(99, 99)); }
/// <summary> /// Test Heuristic.WeightMove /// </summary> private void TestComboDetection(string gridString, int combosCount) { var grid = GridTests.CreateGrid(gridString, 0); var move = new AIMove() { gridAfterMove = grid.ToIntArray() }; var h = new AIHeuristic(); var w = h.WeightMove(move, grid.width, grid.height, 0); Assert.AreEqual(combosCount, w.combosCount); if (combosCount > 0) { Assert.AreNotEqual(0, w.total); } }