public override object Task2() { List <int> scoreSequence = new List <int>(); foreach (char c in input[0]) { scoreSequence.Add((int)char.GetNumericValue(c)); } int scoreSeqLen = input[0].Length; RecipeMaker rp = new RecipeMaker(); while (rp.recipeScores.Count - 1 - scoreSeqLen < 0) { rp.SimulateRound(); } int lastLen = rp.recipeScores.Count; while (true) { rp.SimulateRound(); // this mess is much quicker than comparing a List<T>.GetRange() bool match = true; for (int i = 1; i <= scoreSeqLen; i++) { match &= (rp.recipeScores[^ i] == scoreSequence[^ i]);
public override object Task1() { int turns = int.Parse(input[0]); RecipeMaker rp = new RecipeMaker(); while (rp.recipeScores.Count < turns + 10) { rp.SimulateRound(); } return(string.Join("", rp.recipeScores.GetRange(turns, 10))); }