Beispiel #1
0
 public List <Tile> TilesOnPath()  //Gathers all tiles on path recursively and returns them
 {
     if (PreviousSteps == null)
     {
         return(new List <Tile>()); //return empty list if ther is no PreviousStep
     }
     else
     {
         List <Tile> childList = PreviousSteps.TilesOnPath(); // Calls it self recursively to get all tiles of the path
         childList.Add(LastStep);                             //Add own Last Step
         return(childList);
     }
 }
Beispiel #2
0
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return(PreviousSteps == null?LastStep.ToString() : $"{PreviousSteps.ToString(format, formatProvider)} -> {LastStep}");

            //var diff = (TotalCost - PreviousSteps.TotalCost).ToString(format, formatProvider);
        }