コード例 #1
0
        public IntCodeCpu UseInitialValueThenOutputs(BigInteger value, IntCodeCpu inputCpu)
        {
            var first = false;

            ReadInputValue = () =>
            {
                if (first)
                {
                    logger.LogTrace($"Input: {value:N0}");
                    return(value);
                }

                return(inputCpu.LastOutput);
            };

            return(this);
        }
コード例 #2
0
        public static IntCodeCpu Load(this IntCodeCpu cpu, IEnumerable <int> program)
        {
            var bigIntProgram = program.Select(x => new BigInteger(x)).ToArray();

            return(cpu.Load(bigIntProgram));
        }
コード例 #3
0
        public static IntCodeCpu Load(this IntCodeCpu cpu, string csv)
        {
            var program = csv.ToProgram();

            return(cpu.Load(program));
        }