Example #1
0
 private static void AlgorithmDone(DrawingSurface ds)
 {
     ds.FillGraph(Color.Lime, Color.Lime);
     Thread.Sleep(500);
     ds.FillGraph(Color.White, Color.Gray);
     Thread.Sleep(500);
 }
Example #2
0
        public void Build(DrawingSurface ds, bool visualize)
        {
            (width, height) = (ds.Width - 2 * Circle.radious, ds.Height - 2 * Circle.radious);
            var adjM = GetNotDirectedAdjMatrix(ds.Edges);

            isReady = false;
            int sleepTime = 25;

            ds.TurnMoving(false);
            FillArrays();
            for (var i = 0; i < 10000 && !isReady; ++i)
            {
                Move(adjM);
                sleepTime = (i > 1500) ? 10 : (i > 2500) ? 0 : sleepTime;
                if (visualize && i > 20)
                {
                    Visualize(ds, sleepTime);
                }
            }
            Visualize(ds, 0);
            if (visualize)
            {
                ds.FillGraph(Color.Lime, Color.Lime);
                Thread.Sleep(1000);
                ds.FillGraph(Color.White, Color.Gray);
            }
            ds.TurnMoving(true);
        }