コード例 #1
0
        public virtual void PrintPathSpecial(Room current)
        {
            while (current.Depth != 0)
            {
                foreach (Connection link in current.Links)
                {
                    if (link.To.Depth == current.Depth - 1)
                    {
                        if (link.Type == ConnectionType.Climb)
                        {
                            link.Distance *= 2;
                        }

                        current = link.To;
                        CorrectPathLinks.Add(link);
                        break;
                    }
                }
            }

            // Console.WriteLine("Cost:" + PathLinks.Select(x => x.Distance).Sum());
            CorrectPathLinks.Reverse();

            Console.WriteLine("\nPath is:");
            foreach (var link in CorrectPathLinks)
            {
                Console.WriteLine(link.To.Name + " - " + link.From.Name);
            }
            Console.WriteLine("Cost of Path is:" + CorrectPathLinks.Select(x => x.Distance).Sum());
            Console.WriteLine("Number of Total Links:" + CorrectPathLinks.Count());
            Console.WriteLine("Number of Lift Links:" + CorrectPathLinks.Where(x => x.Type == ConnectionType.Elevator).Count());
            Console.WriteLine("Number of Climb Links:" + CorrectPathLinks.Where(x => x.Type == ConnectionType.Climb).Count());
            Console.WriteLine("Number of Walk Links:" + CorrectPathLinks.Where(x => x.Type == ConnectionType.Walk).Count());
        }
コード例 #2
0
ファイル: CoordinateSearch.cs プロジェクト: Nookiie/IIProject
 private void AddCorrectLink(Connection link)
 {
     CorrectPathLinks.Add(link);
 }