Log in to get your input and submit your answers.

Day 11: Seating System

After daisy-chaining your joltage adapters, you finally make it into 42's main amphitheater for the Bocal's mandatory keynote.

Students trickle in one by one to find a seat. But being exhausted coders, everyone adheres to strict seating etiquette to avoid sitting too close to others.

The layout of the auditorium (your puzzle input) is represented as a character grid:

Part 1

All students apply the following rules simultaneously in rounds:

Floor tiles (.) never change.

Example

Consider this small auditorium layout initially:

L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL

In the first round, since all seats are empty, they all become occupied (#). In subsequent rounds, seats with too many occupied neighbors empty out. Eventually, the seating arrangement stabilizes.

In this example, once the layout stops changing, 37 seats end up occupied.

Simulate the seating process on your own input grid. Once people stop moving around, how many seats end up occupied?