part1 (3510B)
1--- Day 14: Chocolate Charts --- 2 3You finally have a chance to look at all of the produce moving around. Chocolate, cinnamon, mint, 4chili peppers, nutmeg, vanilla... the Elves must be growing these plants to make [1m[97mhot chocolate[0m! As 5you realize this, you hear a conversation in the distance. When you go to investigate, you discover 6two Elves in what appears to be a makeshift underground kitchen/laboratory. 7 8The Elves are trying to come up with the ultimate hot chocolate recipe; they're even maintaining a 9scoreboard which tracks the quality [1m[97mscore[0m (0-9) of each recipe. 10 11Only two recipes are on the board: the first recipe got a score of 3, the second, 7. Each of the two 12Elves has a [1m[97mcurrent recipe[0m: the first Elf starts with the first recipe, and the second Elf starts 13with the second recipe. 14 15To create new recipes, the two Elves combine their current recipes. This creates new recipes from 16the [1m[97mdigits of the sum[0m of the current recipes' scores. With the current recipes' scores of 3 and 7, 17their sum is 10, and so two new recipes would be created: the first with score 1 and the second with 18score 0. If the current recipes' scores were 2 and 3, the sum, 5, would only create one recipe (with 19a score of 5) with its single digit. 20 21The new recipes are added to the end of the scoreboard in the order they are created. So, after the 22first round, the scoreboard is 3, 7, 1, 0. 23 24After all new recipes are added to the scoreboard, each Elf picks a new current recipe. To do this, 25the Elf steps forward through the scoreboard a number of recipes equal to [1m[97m1 plus the score of their 26current recipe[0m. So, after the first round, the first Elf moves forward 1 + 3 = 4 times, while the 27second Elf moves forward 1 + 7 = 8 times. If they run out of recipes, they loop back around to the 28beginning. After the first round, both Elves happen to loop around until they land on the same 29recipe that they had in the beginning; in general, they will move to different recipes. 30 31Drawing the first Elf as parentheses and the second Elf as square brackets, they continue this 32process: 33 34(3)[7] 35(3)[7] 1 0 36 3 7 1 [0](1) 0 37 3 7 1 0 [1] 0 (1) 38(3) 7 1 0 1 0 [1] 2 39 3 7 1 0 (1) 0 1 2 [4] 40 3 7 1 [0] 1 0 (1) 2 4 5 41 3 7 1 0 [1] 0 1 2 (4) 5 1 42 3 (7) 1 0 1 0 [1] 2 4 5 1 5 43 3 7 1 0 1 0 1 2 [4](5) 1 5 8 44 3 (7) 1 0 1 0 1 2 4 5 1 5 8 [9] 45 3 7 1 0 1 0 1 [2] 4 (5) 1 5 8 9 1 6 46 3 7 1 0 1 0 1 2 4 5 [1] 5 8 9 1 (6) 7 47 3 7 1 0 (1) 0 1 2 4 5 1 5 [8] 9 1 6 7 7 48 3 7 [1] 0 1 0 (1) 2 4 5 1 5 8 9 1 6 7 7 9 49 3 7 1 0 [1] 0 1 2 (4) [1m[97m5 1 5 8 9 1 6 7 7 9[0m 2 50 51The Elves think their skill will improve after making a few recipes (your puzzle input). However, 52that could take ages; you can speed this up considerably by identifying [1m[97mthe scores of the ten 53recipes[0m after that. For example: 54 55 56 - If the Elves think their skill will improve after making 9 recipes, the scores of the ten recipes 57[1m[97mafter[0m the first nine on the scoreboard would be 5158916779 (highlighted in the last line of the 58diagram). 59 60 - After 5 recipes, the scores of the next ten would be 0124515891. 61 62 - After 18 recipes, the scores of the next ten would be 9251071085. 63 64 - After 2018 recipes, the scores of the next ten would be 5941429882. 65 66 67[1m[97mWhat are the scores of the ten recipes immediately after the number of recipes in your puzzle 68input?[0m 69 70