Beispiel #1
0
        static void Main(string[] args)
        {
            while (true)
            {
                int width;
                int height;
                int borderWidth = 1;
                int delay;

                int minNeighbour;
                int maxNeighbour;
                int reqNeighbour;

                char livingCell = 'X';
                char deadCell   = ' ';

                Console.Write("Board widht:");
                width = Convert.ToInt32(Console.ReadLine());
                Console.Write("Board height:");
                height = Convert.ToInt32(Console.ReadLine());
                Console.Write("Delay(in ms):");
                delay = Convert.ToInt32(Console.ReadLine());

                Console.Write("Minimum neighbour:");
                minNeighbour = Convert.ToInt32(Console.ReadLine());
                Console.Write("Maximum neighbour:");
                maxNeighbour = Convert.ToInt32(Console.ReadLine());
                Console.Write("Neighbour(s) required to reproduce:");
                reqNeighbour = Convert.ToInt32(Console.ReadLine());

                Console.Clear();

                GameOfLife.CreateInstance(width, height, borderWidth, ConsoleColor.Black, ConsoleColor.DarkGreen, livingCell, deadCell, delay, minNeighbour, maxNeighbour, reqNeighbour);
                GameOfLife.StartGame();

                //Population is stagnant / died
                Console.WriteLine("Press any key to restart");
                Console.ReadLine();
                Console.Clear();
            }
        }