public AutomataProcessor(AutomataDefinition definition, AutomataGrid grid)
        {
            _definition = definition;

            _currentGrid = new AutomataGrid(definition.Neighbourhood == Neighbourhood.Moore, definition.Wrap);
            _backbufferGrid = new AutomataGrid(definition.Neighbourhood == Neighbourhood.Moore, definition.Wrap);

            _currentGrid.Resize(grid.Width, grid.Height);
            _backbufferGrid.Resize(grid.Width, grid.Height);

            for (int idxX = 0; idxX < _currentGrid.Width; ++idxX)
            {
                for (int idxY = 0; idxY < _currentGrid.Height; ++idxY)
                {
                    _currentGrid[idxX, idxY] = grid[idxX, idxY];
                }
            }
        }
        public void ProcessFormula()
        {
            string error;
            AutomataDefinition newDefinition = AutomataDefinition.Create(Formula.StringValue, out error);

            FormulaValid.Value = newDefinition != null;

            if (newDefinition != null)
            {
                Error.StringValue = string.Empty;

                Find<UiEditBox>("Formula").Icon.Value = null;
                _currentDefinition = newDefinition;
                int numStates = newDefinition.NumStates;

                States.Clear();

                for (int idx = 0; idx < numStates; ++idx)
                {
                    States.Add(new EditorState(idx, _stateColors[idx]));
                }
            }
            else
            {
                Find<UiEditBox>("Formula").Icon.Value = ContentLoader.Current.Load<Texture2D>("Ui/Error");
                Error.StringValue = error;
            }
        }