コード例 #1
0
        private int GetOutputToThrusters(string phases)
        {
            var output        = new ThrusterOutput(0);
            var outputChannel = new OutputChannel(output);
            var inputChannel  = new InputChannel();
            var computer      = new OpCodeComputer.OpCodeComputer(inputChannel, outputChannel);

            for (var i = 0; i < 5; i++)
            {
                var pj = phases[i];
                inputChannel.QueueInput(int.Parse(phases.Substring(i, 1)));
                inputChannel.QueueInput(output.Value);

                computer.ProcessInstructions(Program);
            }

            return((int)output.Value);
        }
コード例 #2
0
 public OutputChannel(ThrusterOutput output)
 {
     _output = output;
 }