private void InsertMarble(int value) { int currentIndex = Marbles.IndexOf(CurrentMarble); int secondClockwiseIndex = (currentIndex + 2) % Marbles.Count; if (secondClockwiseIndex == 0) { Marbles.Add(value); } else { Marbles.Insert(secondClockwiseIndex, value); } CurrentMarble = value; }
private long CalculateScore(int value) { long score = value; int seventhClockwiseIndex = (Marbles.IndexOf(CurrentMarble) - 7) % Marbles.Count; if (seventhClockwiseIndex < 0) { seventhClockwiseIndex = Marbles.Count + seventhClockwiseIndex; } score += Marbles[seventhClockwiseIndex]; Marbles.RemoveAt(seventhClockwiseIndex); CurrentMarble = Marbles[seventhClockwiseIndex]; return(score); }