diff options
author | Ben Harris <ben@tilde.team> | 2019-12-09 04:03:50 -0500 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2019-12-09 04:03:50 -0500 |
commit | eb284a98c6febe943c81dc529d881f2a9752ee74 (patch) | |
tree | 842f581574c3033440c4b5579339bc1d876c42dc | |
parent | fc102fe6012ef98831621afe66de06ce5bac996f (diff) |
IEnumerable instead of List
-rw-r--r-- | Day7.cs | 3 | ||||
-rw-r--r-- | Day9.cs | 2 | ||||
-rw-r--r-- | lib/IntCodeVM.cs | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/Day7.cs b/Day7.cs index 9493b81..9391bdb 100644 --- a/Day7.cs +++ b/Day7.cs @@ -9,11 +9,10 @@ namespace aoc2019 { public override int DayNumber => 7; - private readonly List<long> input; private readonly IntCodeVM[] Amplifiers = new IntCodeVM[5]; public Day7() { - input = Input.First().Split(',').Select(long.Parse).ToList(); + var input = Input.First().Split(',').Select(long.Parse); for (var i = 0; i < 5; i++) Amplifiers[i] = new IntCodeVM(input); } diff --git a/Day9.cs b/Day9.cs index 798d509..3f76256 100644 --- a/Day9.cs +++ b/Day9.cs @@ -12,7 +12,7 @@ namespace aoc2019 public Day9() { - vm = new IntCodeVM(Input.First().Split(',').Select(long.Parse).ToList()); + vm = new IntCodeVM(Input.First().Split(',').Select(long.Parse)); } public override string Part1() diff --git a/lib/IntCodeVM.cs b/lib/IntCodeVM.cs index 92cd539..f7699c6 100644 --- a/lib/IntCodeVM.cs +++ b/lib/IntCodeVM.cs @@ -12,7 +12,7 @@ namespace aoc2019.lib private readonly long[] program; public Queue<long> input, output; - public IntCodeVM(List<long> tape) + public IntCodeVM(IEnumerable<long> tape) { i = 0; relbase = 0; |