예제 #1
0
        public void TestRawMaterial(List <string> reactions, int expectedORE, long maxFuel)
        {
            var factory = new NanoFactory(reactions);
            var raw     = factory.GetRawMaterialFor(new ReactionTerm("FUEL", 1));
            var ore     = raw.FirstOrDefault(e => e.Element == "ORE");

            Assert.IsTrue(ore != null);
            Assert.IsTrue(ore.Quantity == expectedORE);

            var maxProduction = factory.GetProductionCapacity("FUEL", new ReactionTerm("ORE", 1000000000000));

            Assert.IsTrue(maxProduction == maxFuel);
        }
예제 #2
0
        /// <summary>
        /// Execution function for Day 14
        /// </summary>
        public void Execute14()
        {
            UserActionAsync(() =>
            {
                WriteToConsole("Start execution of Day14");
                var parser    = GetInputParser("Day14Input.txt");
                var reactions = parser.GetInputData();

                var factory = new NanoFactory(reactions);
                var raw     = factory.GetRawMaterialFor(new ReactionTerm("FUEL", 1));
                var ore     = raw.FirstOrDefault(e => e.Element == "ORE");

                WriteToConsole($"In order to produce one unit of FUEL {ore.Quantity} units ORE are needed");

                var maxProduction = factory.GetProductionCapacity("FUEL", new ReactionTerm("ORE", 1000000000000));

                WriteToConsole($"With 1000000000000 of ORE {maxProduction} units FUEL might be produced");
            });
        }