aboutsummaryrefslogtreecommitdiff
path: root/2020/20/solve.c
diff options
context:
space:
mode:
authorMarvin Borner2020-12-20 16:12:34 +0100
committerMarvin Borner2020-12-20 16:12:34 +0100
commit144f82f96782c6f0dbd85df836afaca284bec022 (patch)
tree63b223c9e5f6f802ad56f81c12dd7e5cd86a1f05 /2020/20/solve.c
parent1991d484d2d9960bc075109211c968acbb0655f0 (diff)
OMG I'm so dumb :O
I forgot to apply the reverse function to the other sides...
Diffstat (limited to '2020/20/solve.c')
-rw-r--r--2020/20/solve.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/2020/20/solve.c b/2020/20/solve.c
index 15d0a64..e6dd59d 100644
--- a/2020/20/solve.c
+++ b/2020/20/solve.c
@@ -75,6 +75,9 @@ long part_one(FILE *fp)
for (int i = 0; i < tile_cnt; i++) {
struct tile *tile = &tiles[i];
reverse(tile->top_rev, tile->top);
+ reverse(tile->right_rev, tile->right);
+ reverse(tile->bottom_rev, tile->bottom);
+ reverse(tile->left_rev, tile->left);
}
for (int i = 0; i < tile_cnt; i++) {
@@ -109,7 +112,6 @@ long part_one(FILE *fp)
}
for (int k = 0; k < tile_cnt; k++) {
- printf("%d: %d %d\n", cnt, tile->id, j);
struct tile *cmp = &tiles[k];
if (cmp->id == tile->id)
continue;
@@ -154,13 +156,11 @@ long part_one(FILE *fp)
int cnt = 0;
for (int j = 0; j < tile_cnt; j++) {
- //if (tile->match[j] > cnt)
cnt += tile->match[j];
}
- printf("%d - %d\n", cnt, tile->id);
- /* res *= tile->id; */
- //printf("%d\n", tile->best_cnt);
+ if (cnt == 2)
+ res *= tile->id;
}
return res;