diff options
Diffstat (limited to 'src/24/part1')
| -rw-r--r-- | src/24/part1 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/24/part1 b/src/24/part1 new file mode 100644 index 0000000..8ad7455 --- /dev/null +++ b/src/24/part1 @@ -0,0 +1,61 @@ +--- Day 24: Lobby Layout --- + +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. + +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 [1m[37mnew tile floor[0m. + +The tiles are all [1m[37mhexagonal[0m; 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. + +The tiles are all [1m[37mwhite[0m on one side and [1m[37mblack[0m 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. + +A member of the renovation crew gives you a [1m[37mlist of the tiles that need to be flipped +over[0m (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 [1m[37mreference tile[0m in the very center +of the room. (Every line starts from the same reference tile.) + +Because the tiles are hexagonal, every tile has [1m[37msix neighbors[0m: 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 [1m[37mno +delimiters[0m; 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. + +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. + +Here is a larger example: + +sesenwnenenewseeswwswswwnenewsewsw +neeenesenwnwwswnenewnwwsewnenwseswesw +seswneswswsenwwnwse +nwnwneseeswswnenewneswwnewseswneseene +swweswneswnenwsewnwneneseenw +eesenwseswswnenwswnwnwsewwnwsene +sewnenenenesenwsewnenwwwse +wenwwweseeeweswwwnwwe +wsweesenenewnwwnwsenewsenwwsesesenwne +neeswseenwwswnwswswnw +nenwswwsewswnenenewsenwsenwnesesenew +enewnwewneswsewnwswenweswnenwsenwsw +sweneswneswneneenwnewenewwneswswnese +swwesenesewenwneswnwwneseswwne +enesenwswwswneneswsenwnewswseenwsese +wnwnesenesenenwwnenwsewesewsesesew +nenewswnwewswnenesenwnesewesw +eneswnwswnwsenenwnwnwwseeswneewsenese +neswnwewnwnwseenwseesewsenwsweewe +wseweeenwnesenwwwswnew + +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 [1m[37m10[0m +tiles are [1m[37mblack[0m. + +Go through the renovation crew's list and determine which tiles they need to flip. After all of the +instructions have been followed, [1m[37mhow many tiles are left with the black side up?[0m + + |
