public static void Run(LevelAnalyzed level)
        {
            Console.WriteLine();
            Console.WriteLine("---------------------");
            Console.WriteLine("Running A_STAR.cs");
            Console.WriteLine("---------------------");
            // local variables
            var Agents = level.Agents;
            var Boxes  = level.Boxes;
            var Goals  = level.Goals;

            /*
             * //switch Target from Boxes and Goals//<------------------
             * var @Switch = 0 ;
             *
             * while (@Switch < 2)
             * {
             * if (@Switch == 0)
             * {
             * var Target = Boxes;
             *
             * }
             * else (@Switch == 1)
             * {
             * var Target = Boxes;
             * }
             */

            //var Target = Boxes;
            var Target = Goals;
Exemple #2
0
        public Heuristic(LevelAnalyzed level, IHeuristicValue heuristicValue)
        {
            this.Level          = level;
            this.heuristicValue = heuristicValue;

            // TODO: Should we always calculate distances here?
            CalculateDistancesToGoals();
        }
 public static void Run(LevelAnalyzed level)
 {
     Console.WriteLine();
     Console.WriteLine("---------------------");
     Console.WriteLine("Running A_STAR_BOXES.cs");
     Console.WriteLine("---------------------");
     // local variables
     var Agents = level.Agents;
     var Boxes  = level.Boxes;
     var Goals  = level.Goals;
Exemple #4
0
 public AStar(LevelAnalyzed level, IHeuristicValue heuristicValue) : base(level, heuristicValue)
 {
 }
Exemple #5
0
        public static void Run(LevelAnalyzed level)
        {
            // Version 1: create a List of ints.
            // ... Add 4 ints to it.
            var numbers = new List <int>();

            numbers.Add(2);
            numbers.Add(3);
            numbers.Add(4);
            numbers.Add(7);
            Console.WriteLine("LIST 1: " + numbers.Count);
            Console.WriteLine(numbers.Min());

            // Version 2: create a List with an initializer.
            var numbers2 = new List <int>()
            {
                2, 2, 3, 5, 7
            };

            Console.WriteLine("LIST 2: " + numbers2.Count);
            Console.WriteLine(numbers2.Min());

            /*
             * //Console.WriteLine();
             * //Console.WriteLine("Running DEMO.cs");
             * // PRINT ALL THE AGENTS AND GOALS, WITH SYMBOLS AND LOCATIONS
             * for (var r = 0; r < level.Rows; r++)
             * {
             *  for (var c = 0; c < level.Columns; c++)
             *  {
             *      var cell = level.Map[r, c];
             *      var goalcell = level.GoalsMap[r,c];
             *      //var mark = level.Map[r,c].Symbol;
             *
             *      if (cell is Agent)
             *      {
             *          //Console.WriteLine($"Agent {0} on position: ({r}, {c})", cell.Symbol);
             *          Console.WriteLine($"Agent Symbol: {cell.Symbol}");
             *          Console.WriteLine($"{cell.Location.X} , {cell.Location.Y}");
             *      }
             *      else if (goalcell is Goal)
             *      {
             *          //Console.WriteLine($"Goal {0} on position: ({r}, {c})", goalcell.Symbol);
             *          Console.WriteLine($"Goal Symbol: {goalcell.Symbol}");
             *          Console.WriteLine($"{goalcell.Location.X} , {goalcell.Location.Y}");
             *      }
             *
             *  }
             * }
             *
             * // PRINT MAP ARRAY
             * /*
             * for (var r = 0; r < level.Rows; r++)
             * {
             *  for (var c = 0; c < level.Columns; c++)
             *  {
             *      foreach (var line in level.GoalsMap)
             *      {
             *          Console.WriteLine($"{line}");
             *      }
             *  }
             * }
             *
             * // PRINT ALL THE CELLS IN THE MAP AND THEIR
             * for (var r = 0; r < level.Rows; r++)
             * {
             *  for (var c = 0; c < level.Columns; c++)
             *  {
             *      foreach (var cell in level.Map)
             *      {
             *          Console.WriteLine($"{cell} ({cell.Location.X} , {cell.Location.Y})");
             *      }
             *  }
             * }*/
        }