private void _signalGenerator_SignalOutput(object sender, SignalOutputEventArgs e)
        {
            if (_signals.Any(s => s.RegisterValue('a') == e.Signal.RegisterValue('a')))
            {
                _signalGenerator.Stop();

                var success = true;
                for (int i = 0; i < _signals.Count; i++)
                {
                    if (i % 2 != _signals[i].RegisterValue('b'))
                    {
                        success = false;
                        break;
                    }
                }

                if (success)
                {
                    _solution = _currentInput;
                    return;
                }

                _signals.Clear();
                _currentInput++;
                _signalGenerator.Start(_currentInput);
            }

            _signals.Add(e.Signal);
        }
Exemple #2
0
        protected virtual void OnSignalOutput(int clockValue)
        {
            var args = new SignalOutputEventArgs(clockValue, _registers);

            SignalOutput?.Invoke(this, args);
        }