Пример #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            var init = new GenerationInitializer();
            var gen  = init.Init();


            var output = new ConsoleBoardOutput();

            output.PrintBoard(gen);

            Console.ReadKey();
            bool run = true;

            while (run)
            {
                if (Console.KeyAvailable)
                {
                    var key = Console.ReadKey();
                    run = HandleKey(key, ref run);
                }

                gen.NextGeneration();
                output.PrintBoard(gen);

                Thread.Sleep(200);
            }
        }
Пример #2
0
        private static void SetupAndPlayGameOfLife(GameOfLifeBoard gol, int rows, int columns, int tickGenerations, List <RowColumnLifeStatus> seedList)
        {
            var boardVisualizer = new ConsoleBoardOutput();

            gol.CreateNewBoard(rows, columns);
            if (seedList.Any())
            {
                gol.Seed(seedList);
            }

            gol.PlayGame(tickGenerations, boardVisualizer.Output);
        }