예제 #1
0
        public void FindCycles_ReturnsExpectedResult(string[] memoryBanks, int expectedResult)
        {
            // Arrange
            Redistributer sut = new Redistributer();

            // Act
            int cycles = sut.FindCycles(memoryBanks);

            // Assert
            Assert.That(cycles, Is.EqualTo(expectedResult));
        }
예제 #2
0
        public void RedistributeUntilDuplicateState_ReturnsExpectedResult(string[] memoryBanks, int expectedResult)
        {
            // Arrange
            Redistributer sut = new Redistributer();

            // Act
            int cycles = sut.RedistributeUntilDuplicateState(memoryBanks);

            // Assert
            Assert.That(cycles, Is.EqualTo(expectedResult));
        }
예제 #3
0
        private static void Main()
        {
            const string PUZZLEINPUT = "0\t5\t10\t0\t11\t14\t13\t4\t11\t8\t8\t7\t1\t4\t12\t11";

            Redistributer redistributer = new Redistributer();
            int           cycles        = redistributer.RedistributeUntilDuplicateState(PUZZLEINPUT.Split('\t'));

            Console.WriteLine($"Part 1: {cycles}");

            cycles = redistributer.FindCycles(PUZZLEINPUT.Split('\t'));
            Console.WriteLine($"Part 2: {cycles}");

            Console.ReadKey();
        }