diff --git a/20/solution.c b/20/solution.c index f222fad..4bcff0b 100644 --- a/20/solution.c +++ b/20/solution.c @@ -49,6 +49,8 @@ usage: fscanf(fp, "%ms", &algo); + for (char *ap=algo; *ap; ap++) + *ap = *ap == '#' ? 1 : 0; while (fscanf(fp, "%ms\n", &s) == 1) { size_t len = strlen(s); @@ -96,7 +98,7 @@ usage: else v |= iter & 1; - back[y * stride + x] = algo[v] == '#'; + back[y * stride + x] = algo[v]; } } }