aocc22

Advent of Code 2022
git clone git://www.tkruger.se/aocc22.git
Log | Files | Refs | README

uppgb.c (413B)


      1 #include "common.h"
      2 
      3 int main(int argc, char **argv) {
      4   char **lines;
      5   size_t nlines = readlines(&lines, "input");
      6 
      7   int *r = parse(lines, nlines);
      8 
      9   size_t i, j;
     10   for (j = 0; j < 6; j++) {
     11     for (i = 0; i < 40; i++) {
     12       if (r[j * 40 + i] == i - 1 || r[j * 40 + i] == i + 1 ||
     13           r[j * 40 + i] == i)
     14         printf("#");
     15       else
     16         printf(".");
     17     }
     18     printf("\n");
     19   }
     20 
     21   free(r);
     22 }