예제 #1
0
        static void Main(string[] args)
        {
            var input = File.ReadAllText(@"C:\git\AdventOfCode2019\input\2019 - Day 25.txt");

            var vm = new IntCodeVM(input);

            vm.InputFunction = StartInput;

            var outputs = vm.Run();

            Console.Write(GetOutputString(outputs));
        }
예제 #2
0
        private static long NextInput(IntCodeVM vm)
        {
            var result = _inputs.First();

            _inputs.RemoveAt(0);

            if (!_inputs.Any())
            {
                vm.InputFunction = StartInput;
            }

            return(result);
        }
예제 #3
0
        private static long StartInput(IntCodeVM vm)
        {
            var output = GetOutputString(vm.Outputs);

            vm.Outputs.Clear();

            Console.Write(output);

            var input = Console.ReadLine();

            _inputs = GetInputList(input);

            vm.InputFunction = NextInput;

            return(NextInput(vm));
        }