public void Day22Part2_ReverseDealInc() { SlamShufflerIndex sut = new SlamShufflerIndex(10007, 3324); sut.DealWithIncrement(63); Assert.Equal(9272, sut.TrackedIndex); sut.DealWithIncrement(-63); Assert.Equal(3324, sut.TrackedIndex); }
public void Day22Part1_TestSolutionByFollowingIndexInReverse() { string[] cmds = DayDataUtilities.ReadLinesFromFile("day22.txt"); Assert.NotNull(cmds); Assert.Equal(100, cmds.Length); SlamShufflerIndex sut = new SlamShufflerIndex(10007, 3324); for (int i = cmds.Length - 1; i >= 0; i--) { sut.ShuffleCommandReverse(cmds[i]); } long actual = sut.TrackedIndex; Assert.Equal(2019, actual); }
public void Day22Part1_TestSolutionByFollowingIndex() { string[] cmds = DayDataUtilities.ReadLinesFromFile("day22.txt"); Assert.NotNull(cmds); Assert.Equal(100, cmds.Length); SlamShufflerIndex sut = new SlamShufflerIndex(10007, 2019); foreach (string cmd in cmds) { sut.ShuffleCommand(cmd); } long actual = sut.TrackedIndex; Assert.Equal(3324, actual); }
public void Day22Part2_TestSolutionForwardOnce() { // both are primes, 99% sure. long deckSize = 119315717514047; long shuffleTimes = 101741582076661; string[] cmds = DayDataUtilities.ReadLinesFromFile("day22.txt"); Assert.NotNull(cmds); Assert.Equal(100, cmds.Length); SlamShufflerIndex sut = new SlamShufflerIndex(deckSize, 2020); foreach (var cmd in cmds) { sut.ShuffleCommand(cmd); } long actual = sut.TrackedIndex; Assert.Equal(113106724260569, actual); }
public void Day22Part2_TestSolutionJustOnce() { // both are primes, 99% sure. long deckSize = 119315717514047; long shuffleTimes = 101741582076661; string[] cmds = DayDataUtilities.ReadLinesFromFile("day22.txt"); Assert.NotNull(cmds); Assert.Equal(100, cmds.Length); SlamShufflerIndex sut = new SlamShufflerIndex(deckSize, 2020); for (int i = cmds.Length - 1; i >= 0; i--) { sut.ShuffleCommandReverse(cmds[i]); } long actual = sut.TrackedIndex; Assert.Equal(27321782275977, actual); }