Beispiel #1
0
 internal static int getCost(Tile tile1, Tile tile2)
 {
     return Math.Abs(tile1.X - tile2.X) + Math.Abs(tile1.Y - tile2.Y);
 }
Beispiel #2
0
        private int getHeuristic2()
        {
            Tile currentValue;
            Tile expectedValue;
            int heuristic2;

            heuristic2 = 0;
            for (int i = Constants.MinimumValue; i < Constants.InvisibleValue; i++)
            {
                if (this.Values[i] < Constants.InvisibleValue)
                {
                    currentValue = new Tile(this.Values[i]);
                    expectedValue = new Tile(Solver.GoalArray[i]);
                    heuristic2 += Tile.getCost(currentValue, expectedValue);
                }
            }
            return heuristic2;
        }