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.

The tiles are all white on one side and black on the other. They start with the white side facing up. The room is large enough to fit whatever pattern might need to appear there.

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.)

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, as shown below. "1" marks the reference tile, and the numbers mark the tiles in the order they are visited, ending with tile "5".

For example, **esew** flips a tile immediately adjacent to the reference tile, as shown below.

Here is a larger example:

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, as shown below.

sesenwnenenewseeswwswswwnenewsewsw neeenesenwnwwswnenewnwwsewnenwseswesw seswneswswsenwwnwse nwnwneseeswswnenewneswwnewseswneseene swweswneswnenwsewnwneneseenw eesenwseswswnenwswnwnwsewwnwsene sewnenenenesenwsewnenwwwse wenwwweseeeweswwwnwwe wsweesenenewnwwnwsenewsenwwsesesenwne neeswseenwwswnwswswnw nenwswwsewswnenenewsenwsenwnesesenew enewnwewneswsewnwswenweswnenwsenwsw sweneswneswneneenwnewenewwneswswnese swwesenesewenwneswnwwneseswwne enesenwswwswneneswsenwnewswseenwsese wnwnesenesenenwwnenwsewesewsesesew nenewswnwewswnenesenwnesewesw eneswnwswnwsenenwnwnwwseeswneewsenese neswnwewnwnwseenwseesewsenwsweewe wseweeenwnesenwwwswnew

9: . . . . . . . . . . 8: . . . . . . . * . . 7: . . . . . . . . . . 6: . . . . * * . . . . 5: . . . * . * . * . . 4: . . . . * . . . . . 3: . . . * . . * . . . 2: . . . . * . . . . . 1: . . . . . . . . . . 0: . . . . . . . . . .

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?

## VP 34.1: Black Tiles (15 pts extra)

Use this data:After all of the instructions have been followed, how many tiles are left with the black side up?https://samsclass.info/COMSC132/proj/VP34That number is the flag.

- Any
**black**tile with zero or more than 2 black tiles immediately adjacent to it is flipped to white. - Any
**white**tile with exactly 2 black tiles immediately adjacent to it is flipped to black.

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.

In the above example, the number of black tiles that are facing up after the given number of days has passed is as follows:

After executing this process a total of 100 times, there would be 2208 black tiles facing up.

Day 1: 15 Day 2: 12 Day 3: 25 Day 4: 14 Day 5: 23 Day 6: 28 Day 7: 41 Day 8: 37 Day 9: 49 Day 10: 37 Day 20: 132 Day 30: 259 Day 40: 406 Day 50: 566 Day 60: 788 Day 70: 1106 Day 80: 1373 Day 90: 1844 Day 100: 2208

How many tiles will be black after 100 days?

## VP 34.2: Flipping Tiles (15 pts extra)

Start with the board you made at the end of flag VP 34.1.Execute the process described above for 100 days, flipping more tiles.

How many tiles end up with the black side facing up?

That number is the flag.

Posted 10-12-24