challenge.txt 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --- Day 24: Lobby Layout ---
  2. Your raft makes it to the tropical island; it turns out that the small crab was an excellent navigator. You make your way to the resort.
  3. As you enter the lobby, you discover a small problem: the floor is being renovated. You can't even reach the check-in desk until they've finished installing the new tile floor.
  4. The tiles are all hexagonal; they need to be arranged in a hex grid with a very specific color pattern. Not in the mood to wait, you offer to help figure out the pattern.
  5. The tiles are all white on one side and black on the other. They start with the white side facing up. The lobby is large enough to fit whatever pattern might need to appear there.
  6. A member of the renovation crew gives you a list of the tiles that need to be flipped over (your puzzle input). Each line in the list identifies a single tile that needs to be flipped by giving a series of steps starting from a reference tile in the very center of the room. (Every line starts from the same reference tile.)
  7. Because the tiles are hexagonal, every tile has six neighbors: east, southeast, southwest, west, northwest, and northeast. These directions are given in your list, respectively, as e, se, sw, w, nw, and ne. A tile is identified by a series of these directions with no delimiters; for example, esenee identifies the tile you land on if you start at the reference tile and then move one tile east, one tile southeast, one tile northeast, and one tile east.
  8. Each time a tile is identified, it flips from white to black or from black to white. Tiles might be flipped more than once. For example, a line like esew flips a tile immediately adjacent to the reference tile, and a line like nwwswee flips the reference tile itself.
  9. Here is a larger example:
  10. sesenwnenenewseeswwswswwnenewsewsw
  11. neeenesenwnwwswnenewnwwsewnenwseswesw
  12. seswneswswsenwwnwse
  13. nwnwneseeswswnenewneswwnewseswneseene
  14. swweswneswnenwsewnwneneseenw
  15. eesenwseswswnenwswnwnwsewwnwsene
  16. sewnenenenesenwsewnenwwwse
  17. wenwwweseeeweswwwnwwe
  18. wsweesenenewnwwnwsenewsenwwsesesenwne
  19. neeswseenwwswnwswswnw
  20. nenwswwsewswnenenewsenwsenwnesesenew
  21. enewnwewneswsewnwswenweswnenwsenwsw
  22. sweneswneswneneenwnewenewwneswswnese
  23. swwesenesewenwneswnwwneseswwne
  24. enesenwswwswneneswsenwnewswseenwsese
  25. wnwnesenesenenwwnenwsewesewsesesew
  26. nenewswnwewswnenesenwnesewesw
  27. eneswnwswnwsenenwnwnwwseeswneewsenese
  28. neswnwewnwnwseenwseesewsenwsweewe
  29. wseweeenwnesenwwwswnew
  30. In the above example, 10 tiles are flipped once (to black), and 5 more are flipped twice (to black, then back to white). After all of these instructions have been followed, a total of 10 tiles are black.
  31. Go through the renovation crew's list and determine which tiles they need to flip. After all of the instructions have been followed, how many tiles are left with the black side up?
  32. Your puzzle answer was 469.
  33. --- Part Two ---
  34. The tile floor in the lobby is meant to be a living art exhibit. Every day, the tiles are all flipped according to the following rules:
  35. Any black tile with zero or more than 2 black tiles immediately adjacent to it is flipped to white.
  36. Any white tile with exactly 2 black tiles immediately adjacent to it is flipped to black.
  37. Here, tiles immediately adjacent means the six tiles directly touching the tile in question.
  38. The rules are applied simultaneously to every tile; put another way, it is first determined which tiles need to be flipped, then they are all flipped at the same time.
  39. In the above example, the number of black tiles that are facing up after the given number of days has passed is as follows:
  40. Day 1: 15
  41. Day 2: 12
  42. Day 3: 25
  43. Day 4: 14
  44. Day 5: 23
  45. Day 6: 28
  46. Day 7: 41
  47. Day 8: 37
  48. Day 9: 49
  49. Day 10: 37
  50. Day 20: 132
  51. Day 30: 259
  52. Day 40: 406
  53. Day 50: 566
  54. Day 60: 788
  55. Day 70: 1106
  56. Day 80: 1373
  57. Day 90: 1844
  58. Day 100: 2208
  59. After executing this process a total of 100 times, there would be 2208 black tiles facing up.
  60. How many tiles will be black after 100 days?
  61. Your puzzle answer was 4353.