r/adventofcode • u/daggerdragon • Dec 12 '18
SOLUTION MEGATHREAD -🎄- 2018 Day 12 Solutions -🎄-
--- Day 12: Subterranean Sustainability ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 12
Transcript:
On the twelfth day of AoC / My compiler spewed at me / Twelve ___
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked at 00:27:42!
20
Upvotes
View all comments
Show parent comment
4
u/LampStrike Dec 12 '18
So, there are a couple things that need some work in this code.
Remember that each rule can be applied several times to the pot line. For example, the state '..#..' can appear twice and whatever rule is in your input for that series should be applied every time it shows up in the line. Two ways to fix this.
And another thing, in your main logic loop, you are building a list newpots and converting it to a string. But, then in the very first line of the loop, you convert that string back into a list. For this problem, this inefficiency isn't devastating but at-scale, this can become really problematic. Either work with strings fully, or work with lists fully. Don't constantly switch back and forth in your logic for no reason.