summary refs log tree commit diff homepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-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]);
+	}
 }
fcd&follow=1'>Remove Lua supportJune McEnroe Lua support is unused and the dlsym fwrite/write hacks horrify me. Clean it up. 2021-01-20Fix tests for diff spansJune McEnroe 2021-01-20Avoid matching ':' in make tagsJune McEnroe Otherwise a :: rule includes one of the ':'s in the tag name. 2021-01-19Prefer tag matches not preceded by [[:alnum:]]June McEnroe Otherwise the "id" in "void" matches for "void id". 2021-01-19Escape \ and / in mtags search patternsJune McEnroe 2021-01-20Use mtags in source-filterJune McEnroe 2021-01-19Add mtags to generate tags for make and mdocJune McEnroe 2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe 2021-01-19Don't use a pager if reading standard inputJune McEnroe 2021-01-19Support BSD make syntax and match *.amJune McEnroe These don't really go together, but... 2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe Otherwise it ends up going into Shell state. 2021-01-18Allow matching lexers using first input lineJune McEnroe