Exemple #1
0
        public Day14()
        {
            _map = new bool[128, 128];

            for (int i = 0; i < 128; i++)
            {
                string hash = KnotHash.HashString($"{Seed}-{i}");

                int col = 0;
                foreach (char c in hash)
                {
                    int num = c <= '9' ? c - '0' : c - 'a' + 10;
                    for (int bit = 3; bit >= 0; bit--)
                    {
                        _map[i, col++] = (num & (1 << bit)) != 0;
                    }
                }
            }
        }
Exemple #2
0
        public void Part2()
        {
            string answer = KnotHash.HashString(_input);

            Assert.Equal("541dc3180fd4b72881e39cf925a50253", answer);
        }