Exemplo n.º 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (GameOfLife game = new GameOfLife())
     {
         game.Run();
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            bool[,] array = new bool[6, 12];

            array[1, 4] = true;
            array[2, 3] = true;
            array[2, 4] = true;
            array[2, 5] = true;
            array[3, 4] = true;

            var grid = GameOfLife.GetGrid(array);

            GameOfLife.Print(Console.WriteLine, grid, 0);
            Console.WriteLine("Press Enter To Begin");
            Console.ReadLine();

            GameOfLife.Run(
                grid: grid,
                iterations: 1000,
                iterator: (g) => GameOfLife.Iterate(g, GameOfLife.ApplyConditions),
                print: (gridToPrint, iteration) => GameOfLife.Print(Console.WriteLine, gridToPrint, iteration, clear: Console.Clear),
                postIteration: () => Task.Delay(250).Wait());

            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var gol = new GameOfLife(1000);
            var sw  = new Stopwatch();

            Console.WriteLine("TaskBarrier:");
            sw.Restart();
            var golTB = new GameOfLifeTB(1000);

            golTB.Run(50);
            Console.WriteLine(sw.Elapsed);

            Console.WriteLine("Sequential:");
            sw.Restart();
            gol.Run(50);
            sw.Stop();
            Console.WriteLine(sw.Elapsed);

            Console.WriteLine("Parallel:");
            sw.Restart();
            var golP = new GameOfLifeP(1000);

            golP.Run(50);
            Console.WriteLine(sw.Elapsed);
        }
Exemplo n.º 4
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (GameOfLife game = new GameOfLife())
     {
         game.Run();
     }
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            GameOfLife.GameOfLife gol = new GameOfLife.GameOfLife(1000, 50);

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            gol.Run();

            stopwatch.Stop();

            var serialRuntime = stopwatch.ElapsedMilliseconds;

            System.Console.WriteLine("Serial calculation runtime: {0} ms", serialRuntime);

            //Console.ReadLine();

            gol = new GameOfLife.GameOfLife(1000, 50);

            stopwatch = new Stopwatch();

            stopwatch.Start();

            gol.RunParLoop();

            stopwatch.Stop();

            serialRuntime = stopwatch.ElapsedMilliseconds;
            System.Console.WriteLine("parloop calculation runtime: {0} ms", serialRuntime);


            gol = new GameOfLife.GameOfLife(1000, 50);

            stopwatch = new Stopwatch();

            stopwatch.Start();

            gol.RunParWithBarrier();

            stopwatch.Stop();

            serialRuntime = stopwatch.ElapsedMilliseconds;
            System.Console.WriteLine("par with barrier calculation runtime: {0} ms", serialRuntime);

            Console.ReadLine();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();

            GameOfLife gol = new GameOfLife(1000);

            stopwatch.Start();
            gol.Run(100);
            stopwatch.Stop();
            Console.WriteLine("Serialized exercise: {0}", stopwatch.ElapsedMilliseconds);

            GameOfLife golfor = new ForEachGameOfLife(1000);

            stopwatch.Restart();
            golfor.Run(100);
            stopwatch.Stop();
            Console.WriteLine("Parallel For-loop: {0}", stopwatch.ElapsedMilliseconds);
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            GameOfLife gol = new GameOfLife(1000);

            gol.Run(100);
        }
Exemplo n.º 8
0
        static void Main()
        {
            var gameOfLife = new GameOfLife();

            gameOfLife.Run(gameOfLife.CreateMainWindow());
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            GameOfLife gameOfLife = new GameOfLife();

            gameOfLife.Run();
        }
Exemplo n.º 10
0
 static void Main()
 {
     using (var game = new GameOfLife())
         game.Run();
 }