Ejemplo n.º 1
0
        public int Route_calculation(string input)
        {
            var chartBuilder = new AstronomicalChartBuilder();

            var chart       = chartBuilder.Build(input);
            var routeFinder = new AstronomicalRouteFinder(chart);
            var route       = routeFinder.CalculateRoute("YOU", "SAN");

            return(route.Count() - 1); // Minus one because we're already at the first step, as it were
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var chartBuilder = new AstronomicalChartBuilder();
            var input        = File.ReadAllText(args[0]);

            var chart = chartBuilder.Build(input);

            var exporter = new DotExporter();

            exporter.Export(args[0] + ".exported.dot", chart);
        }
Ejemplo n.º 3
0
        public int Complex_chart_from_DSL(string inputFile)
        {
            var chartBuilder = new AstronomicalChartBuilder();
            var input        = File.ReadAllText($".\\{inputFile}.txt");

            var chart = chartBuilder.Build(input);

            var calculator = new ChecksumCalculator();
            var checksum   = calculator.GetChecksum(chart);

            return(checksum);
        }
Ejemplo n.º 4
0
        public void Day6_Part2()
        {
            var chartBuilder = new AstronomicalChartBuilder();
            var input        = File.ReadAllText(@".\PuzzleInput.txt");

            var chart = chartBuilder.Build(input);

            var routeFinder = new AstronomicalRouteFinder(chart);
            var route       = routeFinder.CalculateRoute("YOU", "SAN");

            Assert.AreEqual(346, route.Count() - 1);
        }
Ejemplo n.º 5
0
        public void Day6_Part1()
        {
            var chartBuilder = new AstronomicalChartBuilder();
            var input        = File.ReadAllText(@".\PuzzleInput.txt");

            var chart = chartBuilder.Build(input);

            var calculator = new ChecksumCalculator();
            var checksum   = calculator.GetChecksum(chart);

            Assert.AreEqual(154386, checksum);
        }