示例#1
0
        public static void Part2(string[] data)
        {
            List <long> numbers = data.Select(long.Parse).ToList();
            MemoryGame  game    = new MemoryGame(numbers);
            long        total   = game.Play(30_000_000);

            Console.WriteLine($"The 30,000,000th number is: {total}.");
        }
示例#2
0
        public void Have_turn_equals_to_starting_numbers_count(
            string startingNumbers,
            int expectedTurn,
            int expectedNumberSpoken)
        {
            // Given
            var memoryGame    = new MemoryGame(startingNumbers);
            var expectedState = new MemoryGameState(expectedTurn, expectedNumberSpoken);

            // When
            var actualState = memoryGame.State;

            // Then
            Assert.Equal(expectedState, actualState);
        }
示例#3
0
        public void Determine_the_number_spoken_at_specific_turn(
            string startingNumbers,
            int expectedTurn,
            int expectedSpokenNumber)
        {
            // Given
            var memoryGame    = new MemoryGame(startingNumbers);
            var expectedState = new MemoryGameState(expectedTurn, expectedSpokenNumber);

            // When
            memoryGame.PlayUpToTurn(expectedTurn);
            var actualState = memoryGame.State;

            // Then
            Assert.Equal(expectedState, actualState);
        }
示例#4
0
        public void Said_zero_when_meet_first_number_spoken(
            string startingNumbers,
            int expectedTurn,
            int expectedNumberSpoken)
        {
            // Given
            var memoryGame    = new MemoryGame(startingNumbers);
            var expectedState = new MemoryGameState(expectedTurn, expectedNumberSpoken);

            // When
            memoryGame.Play();
            var actualState = memoryGame.State;

            // Then
            Assert.Equal(expectedState, actualState);
        }
示例#5
0
        public void Play_until_specific_turn(
            string startingNumbers,
            int expectedTurn,
            int expectedNumberSpoken)
        {
            // Given
            var memoryGame    = new MemoryGame(startingNumbers);
            var expectedState = new MemoryGameState(expectedTurn, expectedNumberSpoken);

            // When
            memoryGame.PlayUpToTurn(expectedTurn);
            var actualState = memoryGame.State;

            // Then
            Assert.Equal(expectedState, actualState);
        }