From b5284230b967505d1a11c8c61664a425c21f26ee Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sat, 19 Mar 2022 15:43:53 +0100 Subject: [PATCH] Improved in-terminal rendering --- src/preview_mnist.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/preview_mnist.c b/src/preview_mnist.c index bfc8d14..b1d1df5 100644 --- a/src/preview_mnist.c +++ b/src/preview_mnist.c @@ -10,18 +10,12 @@ void print_image(unsigned int width, unsigned int height, FILE* ptr, int start) fread(buffer, sizeof(buffer), 1, ptr); int cur; + char tab[] = {' ', '.', ':', '%', '#', '\0'}; for (int i=0; i 150) - printf("0"); - else { - if (cur > 100) - printf("."); - else - printf(" "); - } + cur = (int)buffer[start+j+i*width]; + printf("%c", tab[cur/52]); } printf("\n"); }