So who explained it better, me or ChatGPT? It splits the list up starting from the left, flips the remainder, zips them into tuples such that they all match up, discarding any excess, and if all the numbers match up exactly, it is a match. If it doesn't find such a section, it returns None. When it finds such a mirrored section, it returns the size of that section. This function looks at different parts of a list and checks if one part is a reversed mirror image of another part. I stopped getting AI help when I stopped trying to solve puzzles with Haskell). score_helper does… it’s super hard to explain. For part 1, this function is score_helper. Score_puzzle takes a puzzle (a list of integers), and a function. def score_puzzle(lp: list, f) -> int:ĭef score_helper(p: list, l: int) -> int: I also save the width of a puzzle so I know how many bits to flip when I pivot the table. This returns a list of puzzles as lists of integers. Return (len(puz), ), 2) for line in puz]) ![]() And if you took all those and set them in a matrix, you could tease out numbers from the bits running vertically, and then run the same code again.Īnd in fact that’s exactly what I did. Each row would just be an integer, super fast to compare. I was looking at the puzzle data, and the rocks (‘#’) and ash (‘.’) looked to me like they could be 1s and 0s. Add a hundred for each row before a horizontal reflection, and one for each column before a vertical reflection, and that is part 1. Since there is no corresponding row on the bottom, we don’t worry about it. There’s extra stuff to see at the first row because of the angle of the mirror. The puzzle on the bottom does have a horizontal reflection between the fourth and fifth row. There seems to be a horizontal one, too, between the third and fourth rows, but the reflections aren’t identical. The one on the top has a vertical reflection between the fifth and sixth column. The sample puzzle input is on the left it shows two mirrors. The spot where the reflections meet must be a mirror. It is so difficult to navigate the place that you decide to determine the mirror locations by mapping out the reflections of ash and rock. (Unlike in the renderings, the mirrors on Lava Island only reflect the rocks, the ash, and the other mirrors. ![]() Turns out, there are hundreds of mirrors, and it’s your job to map the reflections you see to determine where, exactly, the mirrors are. You resolutely head toward the volcano ahead of you that is suspiciously not spewing lava, when you trip over a mirror embedded in the ash. Unfortunately, there is no lava to be found! Without lava, the elves at Hot Springs can’t forge the parts to get Metal Island working to get sand flowing to get purification happening and water flowing and snow falling and everything else you have encountered so far. ![]() You were safely launched onto Lava Island by one of the hot springs you found.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |