<commit_before>﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace Engine
{
    public class Gaea
    {
        public Grid Grid { get; }
        public Rules Rules { get; }
        public Generation Cells { get; private set; }
        public static int MinDelayMilliseconds = 25;
        public static int MaxDelayMilliseconds = 500;
        public static int DefaultDelayMilliseconds = 225;
        private int _generationNumber;
        private int _delay = DefaultDelayMilliseconds;

        private CancellationTokenSource _tokenSource;
        private CancellationToken _token;
        private Task _task;

        public Gaea(Grid grid, Rules rules) : this(grid, rules, initialCells: null) { }

        public Gaea(Grid grid, Rules rules, Generation initialCells)
        {
            if (grid == null) throw new ArgumentNullException(nameof(grid), "Cannot be null");
            if (rules == null) throw new ArgumentNullException(nameof(rules), "Cannot be null");

            Grid = grid;
            Rules = rules;
            Cells = initialCells;
        }

        public int DelayMilliseconds
        {
            get { return _delay; }
            set
            {
                if (value < MinDelayMilliseconds || value > MaxDelayMilliseconds)
                    throw new ArgumentOutOfRangeException(nameof(value), $"Must be between {MinDelayMilliseconds} and {MaxDelayMilliseconds} inclusive.");

                _delay = value;
            }
        }

        public void Run(Action<int, Generation> updateGui)
        {
            PerformGenerationTask(updateGui, runMode: true);
        }

        public void Step(Action<int, Generation> updateGui)
        {
            PerformGenerationTask(updateGui, runMode: false);
        }
<commit_msg>simplify optional initial cells on gaea ctor<commit_after>﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace Engine
{
    public class Gaea
    {
        public Grid Grid { get; }
        public Rules Rules { get; }
        public Generation Cells { get; private set; }
        public static int MinDelayMilliseconds = 25;
        public static int MaxDelayMilliseconds = 500;
        public static int DefaultDelayMilliseconds = 225;
        private int _generationNumber;
        private int _delay = DefaultDelayMilliseconds;

        private CancellationTokenSource _tokenSource;
        private CancellationToken _token;
        private Task _task;

        public Gaea(Grid grid, Rules rules, Generation cells = null)
        {
            if (grid == null) throw new ArgumentNullException(nameof(grid), "Cannot be null");
            if (rules == null) throw new ArgumentNullException(nameof(rules), "Cannot be null");

            Grid = grid;
            Rules = rules;
            Cells = cells;
        }

        public int DelayMilliseconds
        {
            get { return _delay; }
            set
            {
                if (value < MinDelayMilliseconds || value > MaxDelayMilliseconds)
                    throw new ArgumentOutOfRangeException(nameof(value), $"Must be between {MinDelayMilliseconds} and {MaxDelayMilliseconds} inclusive.");

                _delay = value;
            }
        }

        public void Run(Action<int, Generation> updateGui)
        {
            PerformGenerationTask(updateGui, runMode: true);
        }

        public void Step(Action<int, Generation> updateGui)
        {
            PerformGenerationTask(updateGui, runMode: false);
        }

{'fraction_non_alphanumeric': 0.0729431721798134, 'fraction_numerical': 0.004523607577042691, 'mean_word_length': 2.142095914742451, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1401966', 'n_tokens_mistral': 901, 'n_tokens_neox': 859, 'n_words': 274}