コード例 #1
0
        public List <Field> CreateFieldList()
        {
            List <Field> fieldList = new List <Field>();

            field = inputs.GetUserInput();

            var round = 0;

            while (round < 1000)
            {
                Field parallelField = new Field()
                {
                    Height = field.Height,
                    Width  = field.Width,
                    Cells  = new bool[field.Height, field.Width],
                };

                parallelField = GenerateField(parallelField);

                fieldList.Add(parallelField);
                round++;
            }

            return(fieldList);
        }
コード例 #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;
                        }
                    }
                }
            }
        }