コード例 #1
0
ファイル: GameOfLife.cs プロジェクト: agamya/GameOfLife
        /// <summary>
        ///     Start the Game of Life App
        /// </summary>
        public void Start()
        {
            do
            {
                PrintInstructionsToScreen();

                // Input for gridsize
                while (!TakeGridSizeFromUser())
                {
                    PrintInvalidInputMessage();
                }
                //Input for live cell
                while (!TakeLiveCellsFromUser())
                {
                    PrintInvalidInputMessage();
                }
                while (!TakeGenerationNumbersFromUser())
                {
                    PrintInvalidInputMessage();
                }
                System.Console.WriteLine("Following grid will be used:");
                //Create Grid
                _grid = GridHelper.CreateGrid(_gridSize, _liveCells);
                //Displaying the grid on UI
                System.Console.WriteLine(_grid.ToConsoleFormattedString());
                System.Console.WriteLine("Press Enter key to continue.");
                System.Console.ReadLine();
                //Start the generations
                StartGenerations();
            } while (GetUserConfirmation());
        }