Beispiel #1
0
        internal long GetPart1Solution()
        {
            string input             = File.ReadAllText(@"Inputs\Day14Input.txt");
            ResourceConverterMap map = new ResourceConverterMap(input);

            FuelConverterCalculator calculator = new FuelConverterCalculator(input, map);

            return(calculator.CalculateRequiredOre());
        }
Beispiel #2
0
        internal long GetPart2Solution()
        {
            string input             = File.ReadAllText(@"Inputs\Day14Input.txt");
            ResourceConverterMap map = new ResourceConverterMap(input);
            long oreCount            = 1_000_000_000_000;

            FuelConverterCalculator calculator = new FuelConverterCalculator(input, map);

            return(calculator.CalculateFuelProduced(oreCount));
        }
Beispiel #3
0
        public void ShouldCalculatePart1ExamplesCorrectly(string relativeFilePath, int expected)
        {
            // Arrange
            string input             = File.ReadAllText(relativeFilePath);
            ResourceConverterMap map = new ResourceConverterMap(input);

            // Act
            FuelConverterCalculator calculator = new FuelConverterCalculator(input, map);
            long actual = calculator.CalculateRequiredOre();

            // Assert
            Assert.Equal(expected, actual);
        }
Beispiel #4
0
        public void ShouldCalculatePart1SolutionCorrectly()
        {
            // Arrange
            string input             = File.ReadAllText(@"Inputs\Day14Input.txt");
            ResourceConverterMap map = new ResourceConverterMap(input);
            int expected             = 899155;

            // Act
            FuelConverterCalculator calculator = new FuelConverterCalculator(input, map);
            long actual = calculator.CalculateRequiredOre();

            // Assert
            Assert.Equal(expected, actual);
        }
Beispiel #5
0
        public void ShouldCalculatePart2SolutionCorrectly()
        {
            // Arrange
            string input             = File.ReadAllText(@"Inputs\Day14Input.txt");
            ResourceConverterMap map = new ResourceConverterMap(input);
            long oreCount            = 1_000_000_000_000;
            long expected            = 2390226;

            // Act
            FuelConverterCalculator calculator = new FuelConverterCalculator(input, map);
            long actual = calculator.CalculateFuelProduced(oreCount);

            // Assert
            Assert.Equal(expected, actual);
        }