示例#1
0
        internal static void Execute()
        {
            EasyTimer timer = new EasyTimer();
            String    times = String.Empty;
            String    time  = String.Empty;

            int[] ints = new int[100000];
            for (int i = 0; i < ints.Length; i++)
            {
                ints[i] = i;
            }
            ints.Shuffle();
            AddText("Merge", ref times);
            #region Merge
            timer.Start();
            ints = Sorter.MergeSort(ints);
            SaveTime("Random: ", ref times, ref timer);
            timer.Start();
            ints = Sorter.MergeSort(ints);
            SaveTime("Ascending: ", ref times, ref timer);
            ints.Reverse();
            timer.Start();
            ints = Sorter.MergeSort(ints);
            SaveTime("Descending: ", ref times, ref timer);
            #endregion
            AddText("Heap", ref times);
            ints.Shuffle();
            #region Heap
            timer.Start();
            ints = Sorter.HeapSort(ints);
            SaveTime("Random: ", ref times, ref timer);
            timer.Start();
            ints = Sorter.HeapSort(ints);
            SaveTime("Ascending: ", ref times, ref timer);
            ints.Reverse();
            timer.Start();
            ints = Sorter.HeapSort(ints);
            SaveTime("Descending: ", ref times, ref timer);
            #endregion
            AddText("Quick", ref times);
            ints.Shuffle();
            #region Quick
            timer.Start();
            Sorter.QuickSort(ints, 0, ints.Length - 1);
            SaveTime("Random: ", ref times, ref timer);
            timer.Start();
            Sorter.QuickSort(ints, 0, ints.Length - 1);
            SaveTime("Ascending: ", ref times, ref timer);
            ints.Reverse();
            timer.Start();
            Sorter.QuickSort(ints, 0, ints.Length - 1);
            SaveTime("Descending: ", ref times, ref timer);
            #endregion
            FileExpert.SaveToRelativePath("sorted.dat", times.Trim());
        }
示例#2
0
 public void Enter(Guy guy, GameTime gameTime)
 {
     guy.Physics.SetYVelocity(-22);
     _entryTimeout.Start(gameTime);
 }
 public void Enter(Guy guy, GameTime gameTime)
 {
     _timer.Start(gameTime);
     _animation.Reset();
 }
示例#4
0
 public void Enter(Guy guy, GameTime gameTime)
 {
     guy.Physics.Stop();
     _animation.Reset();
     _timer.Start(gameTime);
 }