Exemplo n.º 1
0
        private static void SetUpGridStartingState()
        {
            string nextInput;

            Console.WriteLine();
            Console.WriteLine(Output.PromptForCoordsToToggle);
            do
            {
                Console.WriteLine();
                Console.WriteLine(Output.CurrentGridHeader);
                Console.WriteLine(GridFormatter.OutputWithGridLinesAndNumbers(_grid));
                nextInput = GetNextCoordsFromUser();
                if (nextInput == "")
                {
                    continue;
                }
                if (InputValidator.TryParseCoords(nextInput, _grid, out var cellCoordToToggle))
                {
                    _grid.ToggleCellAliveAtCoords(cellCoordToToggle);
                }
                else
                {
                    Console.WriteLine();
                    Console.Write(Output.InvalidCoords);
                }
            } while (nextInput != "");
        }
Exemplo n.º 2
0
        private static void StartSimulation(Game game)
        {
            var cki = new ConsoleKeyInfo();

            Console.WriteLine();
            Console.WriteLine(Output.StartingSimulation);
            while (cki.Key != ConsoleKey.Escape)
            {
                Console.WriteLine(GridFormatter.OutputWithoutGridLinesAndNumbers(_grid));
                Console.WriteLine();
                Console.WriteLine(Output.PromptToProgressTime);
                cki = Console.ReadKey();
                game.ProgressTime();
            }
        }