Esempio n. 1
0
        public bool Star2_Tests(string input)
        {
            _parsedInput = _parser.Parse(new[] { input });

            var solution = _solver.Star2(_parsedInput);

            Console.WriteLine(solution);
            return(solution == 1);
        }
Esempio n. 2
0
        public void Star2()
        {
            _input       = FileHelpers.Read(_filePath);
            _parsedInput = _parser.Parse(_input);

            var solution = _solver.Star2(_parsedInput);

            Console.WriteLine(solution);
            Assert.AreEqual(275, solution);
        }
Esempio n. 3
0
        public int Example1(string inp)
        {
            var inputStr = new[] { inp };
            var input    = new Day2Input().Parse(inputStr);

            var solution = _solver.Star1(input);

            Console.WriteLine(solution);
            return(solution);
        }
Esempio n. 4
0
        public void Star2()
        {
            var fileInput = File.Read();
            var input     = new Day2Input().Parse(fileInput);

            var solution = _solver.Star2(input);

            Console.WriteLine(solution);
            Assert.Pass();
            Assert.AreEqual(7733, solution);
        }
Esempio n. 5
0
        public void Star1()
        {
            var fileInput = File.Read();
            var input     = new Day2Input().Parse(fileInput);

            input.Commands[1] = 12;
            input.Commands[2] = 2;
            var solution = _solver.Star1(input);

            Console.WriteLine(solution);
            Assert.AreEqual(4090689, solution);
        }
Esempio n. 6
0
        public void Day2Method()
        {
            var a = Day2Input.Split(',').Select(int.Parse).ToArray();
            var i = 0;

            while (a[i] != 99)
            {
                if (a[i] == 1)
                {
                    a[a[i + 3]] = a[a[i + 1]] + a[a[i + 2]];
                }
                if (a[i] == 2)
                {
                    a[a[i + 3]] = a[a[i + 1]] * a[a[i + 2]];
                }

                i += 4;
            }
            TestContext.WriteLine(a[0].ToString());
        }