diff --git a/Day7.cs b/Day7.cs index 9391bdb..af66d03 100644 --- a/Day7.cs +++ b/Day7.cs @@ -12,8 +12,7 @@ namespace aoc2019 private readonly IntCodeVM[] Amplifiers = new IntCodeVM[5]; public Day7() { - var input = Input.First().Split(',').Select(long.Parse); - for (var i = 0; i < 5; i++) Amplifiers[i] = new IntCodeVM(input); + for (var i = 0; i < 5; i++) Amplifiers[i] = new IntCodeVM(Input.First()); } diff --git a/Day9.cs b/Day9.cs index 3f76256..8f21e3d 100644 --- a/Day9.cs +++ b/Day9.cs @@ -12,7 +12,7 @@ namespace aoc2019 public Day9() { - vm = new IntCodeVM(Input.First().Split(',').Select(long.Parse)); + vm = new IntCodeVM(Input.First()); } public override string Part1() diff --git a/lib/IntCodeVM.cs b/lib/IntCodeVM.cs index f7699c6..b42a907 100644 --- a/lib/IntCodeVM.cs +++ b/lib/IntCodeVM.cs @@ -12,12 +12,12 @@ namespace aoc2019.lib private readonly long[] program; public Queue input, output; - public IntCodeVM(IEnumerable tape) + public IntCodeVM(string tape) { i = 0; relbase = 0; - program = tape.ToArray(); - memory = tape.ToArray(); + program = tape.Split(',').Select(long.Parse).ToArray(); + memory = program; input = new Queue(); output = new Queue(); }