예제 #1
0
        public Field CreateInputField(string inputHeight, string inputWidth)
        {
            Field field = new Field();

            int height = int.Parse(inputHeight);
            int width  = int.Parse(inputWidth);

            field.Height = height;
            field.Width  = width;
            field.Cells  = new bool[height, width];
            facade.Clear();
            return(field);
        }
예제 #2
0
        public void Loop()
        {
            field = inputs.GetUserInput();
            field = fieldAlterations.GenerateField(field);

            while (true)
            {
                facade.Clear();
                display.DrawGame(field);
                simulation.StartNewGen(field);
                display.WriteProperties(numOfIterations);
                numOfIterations++;

                if (Console.KeyAvailable)
                {
                    var key = Console.ReadKey(true);
                    if (key.Key == ConsoleKey.P)
                    {
                        facade.Clear();
                        facade.WriteLine(Texts.Pause);
                        var answ = facade.ReadLine().ToLower();
                        if (texts.True(answ))
                        {
                            file.Save(field);
                            facade.WriteLine(Texts.Approval);
                            continue;
                        }
                        else if (texts.False(answ))
                        {
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }
        }