Ejemplo n.º 1
0
        public void Solve(BoxPath boxPath, Box begin, Box end)
        {
            RecursiveSolveCallCounter.IncreaseOne();
            BoxPath newBoxPath;

            if (begin == null)
            {
            }
            else if (begin.Row == end.Row && begin.Column == end.Column)
            {
                newBoxPath = boxPath.Clone();
                newBoxPath.Add(begin);
                if (newBoxPath.Sum() <= this.totalRankingList.LowestSum)
                {
                    this.totalRankingList.Add(newBoxPath);
                    //Console.WriteLine($"Count:{this.totalRankingList.Count}, Low:{this.totalRankingList.LowestSum}, BoxPath:{newBoxPath}, Begin:{begin}, End:{end}");
                }
            }
            else if (!boxPath.IsFoundBox(begin))
            {
                newBoxPath = boxPath.Clone();
                newBoxPath.Add(begin);
                if (newBoxPath.Sum() <= this.totalRankingList.LowestSum)
                {
                    Solve(newBoxPath, euklidesSquareBox.Up(begin), end);
                    Solve(newBoxPath, euklidesSquareBox.Down(begin), end);
                    Solve(newBoxPath, euklidesSquareBox.Left(begin), end);
                    Solve(newBoxPath, euklidesSquareBox.Right(begin), end);
                }
            }
        }
Ejemplo n.º 2
0
        public void Solve2(BoxPath boxPath, Box begin, Box end)
        {
            BoxPath newBoxPath;

            if (begin == null)
            {
            }
            else
            {
                newBoxPath = boxPath.Clone();
                newBoxPath.Add(begin);
                if (newBoxPath.Sum() <= this.totalRankingList.LowestSum)
                {
                    SolveAddToRankingList(newBoxPath, begin, end);
                    SolveRecursive(newBoxPath, begin, end);
                }
            }
        }