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}."); }
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); }
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); }
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); }
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); }