From cb10768fa14c4b6ec19d050e13a0c3e00c152874 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 16 Dec 2020 18:06:36 -0500 Subject: move project to subdirectory and add unit testing day 13 is removed from the test so it doesn't take 4 years --- Day01.cs | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 Day01.cs (limited to 'Day01.cs') diff --git a/Day01.cs b/Day01.cs deleted file mode 100644 index d991917..0000000 --- a/Day01.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace aoc2019 -{ - internal sealed class Day01 : Day - { - private readonly IEnumerable masses; - - public Day01() : base(1, "The Tyranny of the Rocket Equation") - { - masses = Input.Select(int.Parse); - } - - private static int FuelCost(int weight) - { - return weight / 3 - 2; - } - - private static int FullCost(int cost) - { - int total = 0, newcost, tmp = cost; - - while ((newcost = FuelCost(tmp)) >= 0) - { - total += newcost; - tmp = newcost; - } - - return total; - } - - protected override string Part1() - { - return $"{masses.Sum(FuelCost)}"; - } - - protected override string Part2() - { - return $"{masses.Sum(FullCost)}"; - } - } -} \ No newline at end of file -- cgit 1.4.1