예제 #1
0
        public void Day22Part1_TestSolutionByFollowingIndex()
        {
            string[] cmds = DayDataUtilities.ReadLinesFromFile("day22.txt");
            Assert.NotNull(cmds);
            Assert.Equal(100, cmds.Length);
            SlamShufflerIndex sut = new SlamShufflerIndex(10007, 2019);

            foreach (string cmd in cmds)
            {
                sut.ShuffleCommand(cmd);
            }

            long actual = sut.TrackedIndex;

            Assert.Equal(3324, actual);
        }
예제 #2
0
        public void Day22Part2_TestSolutionForwardOnce()
        {
            // both are primes, 99% sure.
            long deckSize     = 119315717514047;
            long shuffleTimes = 101741582076661;

            string[] cmds = DayDataUtilities.ReadLinesFromFile("day22.txt");
            Assert.NotNull(cmds);
            Assert.Equal(100, cmds.Length);

            SlamShufflerIndex sut = new SlamShufflerIndex(deckSize, 2020);

            foreach (var cmd in cmds)
            {
                sut.ShuffleCommand(cmd);
            }

            long actual = sut.TrackedIndex;

            Assert.Equal(113106724260569, actual);
        }