Esempio n. 1
0
        public void PartOne(string[] input, TextWriter @out)
        {
            const int cards = 10_007;
            var       deck  = Enumerable.Range(0, cards).ToArray();

            @out.WriteLine($"Card at position 2019: {Array.IndexOf(deck, 2019)}");
            var resultDeck = ShuffleTechniques.RunShuffleTechnique <int>(deck, input);

            @out.WriteLine($"Position of card 2019: {Array.IndexOf(resultDeck, 2019)}");
        }
Esempio n. 2
0
        public void PartTwo(string[] input, TextWriter @out)
        {
            var deck = MassiveDeck().ToArray();

            for (long i = 0; i < 101_741_582_076_661; i++)
            {
                @out.WriteLine($"Shuffle {i}");
                deck = ShuffleTechniques.RunShuffleTechnique <long>(deck, input);
            }

            @out.WriteLine($"Position 2020 contains card: {deck[2020]}");
        }