Piotr Czajkowski 3 years ago
parent
commit
488e9fc03b
3 changed files with 655 additions and 0 deletions
  1. 211 0
      day11/challenge.txt
  2. 347 0
      day11/day11.c
  3. 97 0
      day11/input.txt

+ 211 - 0
day11/challenge.txt

@@ -0,0 +1,211 @@
+--- Day 11: Seating System ---
+
+Your plane lands with plenty of time to spare. The final leg of your journey is a ferry that goes directly to the tropical island where you can finally start your vacation. As you reach the waiting area to board the ferry, you realize you're so early, nobody else has even arrived yet!
+
+By modeling the process people use to choose (or abandon) their seat in the waiting area, you're pretty sure you can predict the best place to sit. You make a quick map of the seat layout (your puzzle input).
+
+The seat layout fits neatly on a grid. Each position is either floor (.), an empty seat (L), or an occupied seat (#). For example, the initial seat layout might look like this:
+
+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
+
+Now, you just need to model the people who will be arriving shortly. Fortunately, people are entirely predictable and always follow a simple set of rules. All decisions are based on the number of occupied seats adjacent to a given seat (one of the eight positions immediately up, down, left, right, or diagonal from the seat). The following rules are applied to every seat simultaneously:
+
+    If a seat is empty (L) and there are no occupied seats adjacent to it, the seat becomes occupied.
+    If a seat is occupied (#) and four or more seats adjacent to it are also occupied, the seat becomes empty.
+    Otherwise, the seat's state does not change.
+
+Floor (.) never changes; seats don't move, and nobody sits on the floor.
+
+After one round of these rules, every seat in the example layout becomes occupied:
+
+#.##.##.##
+#######.##
+#.#.#..#..
+####.##.##
+#.##.##.##
+#.#####.##
+..#.#.....
+##########
+#.######.#
+#.#####.##
+
+After a second round, the seats with four or more occupied adjacent seats become empty again:
+
+#.LL.L#.##
+#LLLLLL.L#
+L.L.L..L..
+#LLL.LL.L#
+#.LL.LL.LL
+#.LLLL#.##
+..L.L.....
+#LLLLLLLL#
+#.LLLLLL.L
+#.#LLLL.##
+
+This process continues for three more rounds:
+
+#.##.L#.##
+#L###LL.L#
+L.#.#..#..
+#L##.##.L#
+#.##.LL.LL
+#.###L#.##
+..#.#.....
+#L######L#
+#.LL###L.L
+#.#L###.##
+
+#.#L.L#.##
+#LLL#LL.L#
+L.L.L..#..
+#LLL.##.L#
+#.LL.LL.LL
+#.LL#L#.##
+..L.L.....
+#L#LLLL#L#
+#.LLLLLL.L
+#.#L#L#.##
+
+#.#L.L#.##
+#LLL#LL.L#
+L.#.L..#..
+#L##.##.L#
+#.#L.LL.LL
+#.#L#L#.##
+..L.L.....
+#L#L##L#L#
+#.LLLLLL.L
+#.#L#L#.##
+
+At this point, something interesting happens: the chaos stabilizes and further applications of these rules cause no seats to change state! Once people stop moving around, you count 37 occupied seats.
+
+Simulate your seating area by applying the seating rules repeatedly until no seats change state. How many seats end up occupied?
+
+Your puzzle answer was 2489.
+--- Part Two ---
+
+As soon as people start to arrive, you realize your mistake. People don't just care about adjacent seats - they care about the first seat they can see in each of those eight directions!
+
+Now, instead of considering just the eight immediately adjacent seats, consider the first seat in each of those eight directions. For example, the empty seat below would see eight occupied seats:
+
+.......#.
+...#.....
+.#.......
+.........
+..#L....#
+....#....
+.........
+#........
+...#.....
+
+The leftmost empty seat below would only see one empty seat, but cannot see any of the occupied ones:
+
+.............
+.L.L.#.#.#.#.
+.............
+
+The empty seat below would see no occupied seats:
+
+.##.##.
+#.#.#.#
+##...##
+...L...
+##...##
+#.#.#.#
+.##.##.
+
+Also, people seem to be more tolerant than you expected: it now takes five or more visible occupied seats for an occupied seat to become empty (rather than four or more from the previous rules). The other rules still apply: empty seats that see no occupied seats become occupied, seats matching no rule don't change, and floor never changes.
+
+Given the same starting layout as above, these new rules cause the seating area to shift around as follows:
+
+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
+
+#.##.##.##
+#######.##
+#.#.#..#..
+####.##.##
+#.##.##.##
+#.#####.##
+..#.#.....
+##########
+#.######.#
+#.#####.##
+
+#.LL.LL.L#
+#LLLLLL.LL
+L.L.L..L..
+LLLL.LL.LL
+L.LL.LL.LL
+L.LLLLL.LL
+..L.L.....
+LLLLLLLLL#
+#.LLLLLL.L
+#.LLLLL.L#
+
+#.L#.##.L#
+#L#####.LL
+L.#.#..#..
+##L#.##.##
+#.##.#L.##
+#.#####.#L
+..#.#.....
+LLL####LL#
+#.L#####.L
+#.L####.L#
+
+#.L#.L#.L#
+#LLLLLL.LL
+L.L.L..#..
+##LL.LL.L#
+L.LL.LL.L#
+#.LLLLL.LL
+..L.L.....
+LLLLLLLLL#
+#.LLLLL#.L
+#.L#LL#.L#
+
+#.L#.L#.L#
+#LLLLLL.LL
+L.L.L..#..
+##L#.#L.L#
+L.L#.#L.L#
+#.L####.LL
+..#.#.....
+LLL###LLL#
+#.LLLLL#.L
+#.L#LL#.L#
+
+#.L#.L#.L#
+#LLLLLL.LL
+L.L.L..#..
+##L#.#L.L#
+L.L#.LL.L#
+#.LLLL#.LL
+..#.L.....
+LLL###LLL#
+#.LLLLL#.L
+#.L#LL#.L#
+
+Again, at this point, people stop shifting around and the seating area reaches equilibrium. Once this occurs, you count 26 occupied seats.
+
+Given the new visibility method and the rule change for occupied seats becoming empty, once equilibrium is reached, how many seats end up occupied?
+
+Your puzzle answer was 2180.

+ 347 - 0
day11/day11.c

@@ -0,0 +1,347 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define LINE_MAX 256
+
+int arraySize = 0;
+
+char **readSeats(FILE *fp) {
+	char **allSeats = NULL;
+	int index = 0;
+	while (1) {
+		char *p = malloc(LINE_MAX);
+		if (!p) return NULL;
+
+		if (1 > fscanf(fp, "%s\n", p))
+			return NULL;
+
+		arraySize++;
+		char **newSeats = realloc(allSeats, sizeof(char*)*arraySize);
+		if (!newSeats) return NULL;
+
+		allSeats = newSeats;
+		allSeats[index] = p;
+		index++;
+
+		if (feof(fp)) break;
+	}
+
+	return allSeats;
+}
+
+size_t lineLength = 0;
+
+int occupied(char **array, int x, int y) {
+	int columnMax = lineLength-1;
+	int rowMax = arraySize-1;
+	if ((x < 0 || x > rowMax) || (y < 0 || y > columnMax)) return 0;
+
+	int upRow = x - 1;
+	if (upRow < 0) upRow = 0;
+	int downRow = x + 1;
+	if (downRow > rowMax) downRow = rowMax;
+
+	int left = y - 1;
+	if (left < 0) left = 0;
+	int right = y + 1;
+	if (right > columnMax) right = columnMax;
+
+	int occupiedCount = 0;
+	for (int i = upRow; i <= downRow; i++) {
+		for (int j = left; j <= right; j++) {
+			if (i == x && j == y) continue;
+			if (array[i][j] == '#') occupiedCount++;
+		}
+	}
+
+	return occupiedCount;
+}
+
+
+
+void freeAllSeats(char **array) {
+	for (int i = 0; i < arraySize; i++)
+		free(array[i]);
+
+	free(array);
+}
+
+int previouslyChanged = 0;
+int currentlyChanged = 0;
+
+char **checkBoard(char **currentBoard, char **newBoard) {
+	currentlyChanged = 0;
+	for (int i = 0; i < arraySize; i++) {
+		char temp[lineLength+1];
+		temp[lineLength] = 0;
+		for (size_t j = 0; j < lineLength; j++) {
+			char *current = &currentBoard[i][j];
+			char new = *current;
+
+			switch (*current) {
+				case 'L':
+					if (!occupied(currentBoard, i, j)) {
+						new = '#';
+						currentlyChanged = 1;
+					}
+					break;
+				case '#':
+					if (occupied(currentBoard, i, j) >= 4) {
+						new = 'L';
+						currentlyChanged = 1;
+					}
+					break;
+			}
+
+			temp[j] = new;
+		}
+		sprintf(newBoard[i], "%s", temp);
+	}
+
+	freeAllSeats(currentBoard);
+
+	return newBoard;
+}
+
+int countOccupied(char **currentBoard) {
+	int occupiedCount = 0;
+	for (int i = 0; i < arraySize; i++) {
+		for (size_t j = 0; j < lineLength; j++) {
+			char *current = &currentBoard[i][j];
+			if (*current == '#') {
+				occupiedCount++;
+			}
+		}
+	}
+
+	return occupiedCount;
+}
+
+char **allocateNewBoard(int rows, int columns) {
+	char **newBoard = malloc(sizeof(char*)*rows);
+	if (!newBoard) return NULL;
+
+	for (int i = 0; i < rows; i++) {
+		newBoard[i] = malloc(columns);
+		if (!newBoard[i]) return NULL;
+	}
+
+	return newBoard;
+}
+
+
+int doRounds(char **array) {
+	char **currentBoard = array;
+	int runs = 0;
+	char **newBoard = NULL;
+	while (1) {
+		newBoard = allocateNewBoard(arraySize, lineLength+1);
+		if (!newBoard) return -1;
+
+		if (runs > 1 && ((currentlyChanged == 0) && (previouslyChanged == 0))) break;
+		previouslyChanged = currentlyChanged;
+
+		currentBoard = checkBoard(currentBoard, newBoard);
+		runs++;
+	}
+
+	int occupied = countOccupied(currentBoard);
+	freeAllSeats(currentBoard);
+	freeAllSeats(newBoard);
+	return occupied;
+}
+
+int occupied2(char **array, int x, int y) {
+	int columnMax = lineLength;
+	int rowMax = arraySize;
+
+	int occupiedCount = 0;
+	for (int i = x+1; i < rowMax; i++) {
+		if (array[i][y] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[i][y] != '.') break;
+	}
+
+	for (int i = x-1; i >= 0; i--) {
+		if (array[i][y] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[i][y] != '.') break;
+	}
+
+	for (int i = y+1; i < columnMax; i++) {
+		if (array[x][i] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[x][i] != '.') break;
+	}
+
+	for (int i = y-1; i >= 0; i--) {
+		if (array[x][i] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[x][i] != '.') break;
+	}
+
+	int currentX = x - 1;
+	int currentY = y - 1;
+	while ((currentX >= 0) && (currentY >= 0)) {
+		if (array[currentX][currentY] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[currentX][currentY] != '.') break;
+
+		currentX--;
+		currentY--;
+	}
+
+	currentX = x + 1;
+	currentY = y + 1;
+	while ((currentX < rowMax) && (currentY < columnMax)) {
+		if (array[currentX][currentY] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[currentX][currentY] != '.') break;
+		currentX++;
+		currentY++;
+	}
+
+	currentX = x - 1;
+	currentY = y + 1;
+	while ((currentX >= 0) && (currentY < columnMax)) {
+		if (array[currentX][currentY] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[currentX][currentY] != '.') break;
+		currentX--;
+		currentY++;
+	}
+
+	currentX = x + 1;
+	currentY = y - 1;
+	while ((currentX < rowMax) && (currentY >= 0)) {
+		if (array[currentX][currentY] == '#') {
+			occupiedCount++;
+			break;
+		}
+
+		if (array[currentX][currentY] != '.') break;
+		currentX++;
+		currentY--;
+	}
+
+	return occupiedCount;
+}
+
+char **checkBoard2(char **currentBoard, char **newBoard) {
+	currentlyChanged = 0;
+	for (int i = 0; i < arraySize; i++) {
+		char temp[lineLength+1];
+		temp[lineLength] = 0;
+		for (size_t j = 0; j < lineLength; j++) {
+			char *current = &currentBoard[i][j];
+			char new = *current;
+
+			switch (*current) {
+				case 'L':
+					if (!occupied2(currentBoard, i, j)) {
+						new = '#';
+						currentlyChanged = 1;
+					}
+					break;
+				case '#':
+					if (occupied2(currentBoard, i, j) >= 5) {
+						new = 'L';
+						currentlyChanged = 1;
+					}
+					break;
+			}
+
+			temp[j] = new;
+		}
+		sprintf(newBoard[i], "%s", temp);
+	}
+
+	freeAllSeats(currentBoard);
+
+	return newBoard;
+}
+
+int doRounds2(char **array) {
+	char **currentBoard = array;
+	int runs = 0;
+	char **newBoard = NULL;
+	while (1) {
+		newBoard = allocateNewBoard(arraySize, lineLength+1);
+		if (!newBoard) return -1;
+
+		if (runs > 1 && ((currentlyChanged == 0) && (previouslyChanged == 0))) break;
+		previouslyChanged = currentlyChanged;
+
+		currentBoard = checkBoard2(currentBoard, newBoard);
+		runs++;
+	}
+
+	int occupied = countOccupied(currentBoard);
+	freeAllSeats(currentBoard);
+	freeAllSeats(newBoard);
+	return occupied;
+}
+
+char **copyBoard(char** array, int rows, int columns) {
+	char **newBoard = malloc(sizeof(char*)*rows);
+	if (!newBoard) return NULL;
+
+	for (int i = 0; i < rows; i++) {
+		newBoard[i] = malloc(columns);
+		if (!newBoard[i]) return NULL;
+		sprintf(newBoard[i], "%s", array[i]);
+	}
+
+	return newBoard;
+}
+
+int main(int argc, char **argv)
+{
+	if (argc < 2) {
+		puts("You need to specify path to file!");
+		return -1;
+	}
+
+	FILE *fp = fopen(argv[1], "r");
+	if (!fp) {
+		puts("Can't open file!");
+		return -1;
+	}
+
+	char **currentBoard = readSeats(fp);
+	if (!currentBoard) {
+		puts("Can't read numbers!");
+		fclose(fp);
+		return -1;
+	}
+	fclose(fp);
+
+	lineLength = strlen(currentBoard[arraySize-1]);
+	char **originalBoard = copyBoard(currentBoard, arraySize, lineLength+1);
+	if (!originalBoard) return -1;
+
+	printf("Part1: %d\n", doRounds(currentBoard));
+	printf("Part2: %d\n", doRounds2(originalBoard));
+}

+ 97 - 0
day11/input.txt

@@ -0,0 +1,97 @@
+LLLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLLLL.LLLLLLL.LLLLL.L.LLLLLLL.LLLLLLLLLLLLLL.LLL.L.L.LLLLLLLLL.LLLLL
+LLLLLL.LLLLLL.LLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLLLL..LLLLL
+LLLLLLLLLLLLL.L.LLL.LLLLLLLL.LLLLLLLLLLLLLL.LLLLLLLLLL.LLLLL.LLLLLLLL.LLLLLLLLLL.LLLLL.LLLLL.LLLLL
+LLLLLL.LLLLLLLLLLLL.LLLLLLLL.L.LLLL.LLLLLLLLLLLLL.LLLL.LLLLL.LL.LLLLL.LLLLLLLLLL.LLLLL.LLLLLL.LLLL
+LLLLLL...LLLLLLLLLLLLLLLLLLL.LLLLLL.LLLLLLL.LLLLL.LLLLLLLLLL.LLLLLLLL.LLLLLLLLLLLLLLLL.LLLLL.LLLLL
+LLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLL.LLLL.LLLLLL.LLLLLLLLLLLLLLLLLLL.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