Exemplo n.º 1
0
        public void Part2()
        {
            List <long> numbers     = StringListRetriever.Retreive("InputList9.txt").Select(x => long.Parse(x)).ToList();
            int         preamble    = 25;
            XmasDecoder xmasDecoder = new XmasDecoder();

            xmasDecoder.Decode(numbers, preamble);
            Assert.Equal(552655238, xmasDecoder.BadNumber);
            Assert.Equal(610, xmasDecoder.BadIndex);
            List <long> badSet = xmasDecoder.FindSetFor(numbers, xmasDecoder.BadIndex);

            Assert.Equal(70672245, badSet.Min() + badSet.Max());
        }
Exemplo n.º 2
0
        public void Part2Sample()
        {
            List <long> numbers     = GetSampleList();
            int         preamble    = 5;
            XmasDecoder xmasDecoder = new XmasDecoder();

            xmasDecoder.Decode(numbers, preamble);
            Assert.Equal(14, xmasDecoder.BadIndex);
            Assert.Equal(127, xmasDecoder.BadNumber);
            List <long> badSet = xmasDecoder.FindSetFor(numbers, xmasDecoder.BadIndex);

            Assert.Equal(15, badSet.Min());
            Assert.Equal(47, badSet.Max());
            Assert.Equal(62, badSet.Min() + badSet.Max());
        }