Esempio n. 1
0
        public RepairDroid(IntCodeStateMachine cpu, ICommandInput commandInput)
        {
            _cpu          = cpu;
            _commandInput = commandInput;
            _commandInput.InputReceived += (_, v) =>
            {
                var cmd = (MovementCommand)v;
                if (v < 1 || v > 4)
                {
                    throw new Exception("Wrong input value");
                }
                _cpu.SetInput((int)cmd);
            };

            _cpu.OnOutput += (_, o) =>
            {
                _lastOutput = (RepairDroidStatusCode)o;
                OnReply?.Invoke(this, _lastOutput);
                commandInput.AwaitInput();
            };
        }
Esempio n. 2
0
 public ReportStatusEventArgs(RepairDroidStatusCode statusCode) : base()
 {
     StatusCode = statusCode;
 }