summary refs log tree commit diff homepage
path: root/2019
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-11 18:20:46 -0500
committerJune McEnroe <june@causal.agency>2019-12-11 18:20:46 -0500
commitaf95e6aa20a7be982a0e91b8aa5ea46b22df4e8a (patch)
treedf23ad862a66458206c85b7b85e1d458eb1f9ca8 /2019
parentSolve day 8 part 1 (diff)
downloadaoc-af95e6aa20a7be982a0e91b8aa5ea46b22df4e8a.tar.gz
aoc-af95e6aa20a7be982a0e91b8aa5ea46b22df4e8a.zip
Solve day 8 part 2
Diffstat (limited to '2019')
-rw-r--r--2019/day08.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/2019/day08.c b/2019/day08.c
index 05011c8..4ddbc60 100644
--- a/2019/day08.c
+++ b/2019/day08.c
@@ -25,4 +25,19 @@ int main(void) {
 		}
 	}
 	printf("%d\n", one * two);
+
+	char img[6][25];
+	for (size_t l = len - 1; l < len; --l) {
+		for (int y = 0; y < 6; ++y) {
+			for (int x = 0; x < 25; ++x) {
+				switch (layers[l][y][x]) {
+					break; case '0': img[y][x] = '.';
+					break; case '1': img[y][x] = '#';
+				}
+			}
+		}
+	}
+	for (int y = 0; y < 6; ++y) {
+		printf("%.*s\n", 25, img[y]);
+	}
 }