diff options
author | Ben Harris <ben@tilde.team> | 2020-12-01 23:50:35 -0500 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2020-12-01 23:50:35 -0500 |
commit | 00c3b51b897c33210679de546eebcd9ec75247a1 (patch) | |
tree | 04c13f15931c8c2d5115fbd68df6c1ea274316fe /Day14.cs | |
parent | 9958bed8325538d586986df351f18fda35662ff7 (diff) |
seal classes
Diffstat (limited to 'Day14.cs')
-rw-r--r-- | Day14.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Day14.cs b/Day14.cs index 99e28e0..7706c0b 100644 --- a/Day14.cs +++ b/Day14.cs @@ -4,7 +4,7 @@ using System.Linq; namespace aoc2019 { - internal class Day14 : Day + internal sealed class Day14 : Day { public override int DayNumber => 14; @@ -19,10 +19,10 @@ namespace aoc2019 private class Reaction { - public Component product; - public Component[] reactants; + public readonly Component product; + public readonly Component[] reactants; - public Reaction(Component[] reactants, Component product) + private Reaction(Component[] reactants, Component product) { this.reactants = reactants; this.product = product; @@ -39,11 +39,11 @@ namespace aoc2019 static Component ParseComponent(string s) { - var i = s.IndexOf(' '); + var spl = s.Split(' ', 2); return new Component { - Name = s[(i + 1)..], - Quantity = int.Parse(s.Substring(i)) + Quantity = int.Parse(spl[0]), + Name = spl[1] }; } } |