summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-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]);
+	}
 }