예제 #1
0
        public void CreateNewRecipes()
        {
            var combinedScore = 0;

            foreach (var elfRecipeIndex in ElvesCurrentRecipeIndexes)
            {
                combinedScore += RecipeScores[elfRecipeIndex];
            }

            if (combinedScore >= 10)
            {
                var first  = combinedScore / 10;
                var second = combinedScore % 10;

                RecipeScores.AddRange(new[] { first, second });
            }
            else
            {
                RecipeScores.Add(combinedScore);
            }

            for (var index = 0; index < ElvesCurrentRecipeIndexes.Count; index++)
            {
                var elfRecipeIndex = ElvesCurrentRecipeIndexes[index];

                var currentRecipeScore = RecipeScores[elfRecipeIndex];
                var steps = currentRecipeScore + 1;

                var newIndex        = elfRecipeIndex + steps;
                var normalizedIndex = newIndex % RecipeScores.Count;

                ElvesCurrentRecipeIndexes[index] = normalizedIndex;
            }
        }
예제 #2
0
        public string GetScoreAfterRecipeCount(int recipeCount)
        {
            var targetRecipeCount = recipeCount + ScoreLength;

            while (RecipeScores.Count < targetRecipeCount)
            {
                CreateNewRecipes();
            }

            var scoreItems = RecipeScores.GetRange(recipeCount, ScoreLength);
            var score      = new StringBuilder();

            foreach (var scoreItem in scoreItems)
            {
                score.Append(scoreItem);
            }

            return(score.ToString());
        }