aboutsummaryrefslogtreecommitdiff
path: root/2023/16
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-12-25 17:56:34 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-12-25 17:56:34 +0100
commit94d0033ed89bb5bfb6500051296892fb7cea6c29 (patch)
tree245eac2218310c958c2df2fad5109ea4f7b2a9d9 /2023/16
parent6a480c4eb9c96c82a8fd3663f0fbee4d32e56f19 (diff)
downloadaoc-94d0033ed89bb5bfb6500051296892fb7cea6c29.tar.gz
aoc-94d0033ed89bb5bfb6500051296892fb7cea6c29.zip
Small cleanup
Diffstat (limited to '2023/16')
-rw-r--r--2023/16/16a.c5
-rw-r--r--2023/16/16b.c4
2 files changed, 2 insertions, 7 deletions
diff --git a/2023/16/16a.c b/2023/16/16a.c
index 0f95553..79aba38 100644
--- a/2023/16/16a.c
+++ b/2023/16/16a.c
@@ -1,7 +1,4 @@
1#include <stdbool.h>
2#include <stdio.h> 1#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
5 2
6#define M 200 3#define M 200
7 4
@@ -25,7 +22,7 @@ void walk(int i, int j, int d) {
25 if (!entered[i][j]) s++; 22 if (!entered[i][j]) s++;
26 entered[i][j] |= d; 23 entered[i][j] |= d;
27 for (int k = 1; k <= 8; k <<= 1) 24 for (int k = 1; k <= 8; k <<= 1)
28 if (k & turn[d][map[i][j]]) 25 if (k & turn[d][(int)map[i][j]])
29 walk(i+go[k][0], j+go[k][1], k); 26 walk(i+go[k][0], j+go[k][1], k);
30} 27}
31 28
diff --git a/2023/16/16b.c b/2023/16/16b.c
index ce42c31..6247942 100644
--- a/2023/16/16b.c
+++ b/2023/16/16b.c
@@ -1,6 +1,4 @@
1#include <stdbool.h>
2#include <stdio.h> 1#include <stdio.h>
3#include <stdlib.h>
4#include <string.h> 2#include <string.h>
5 3
6#define M 200 4#define M 200
@@ -26,7 +24,7 @@ void walk(int i, int j, int d) {
26 if (!entered[i][j]) s++; 24 if (!entered[i][j]) s++;
27 entered[i][j] |= d; 25 entered[i][j] |= d;
28 for (int k = 1; k <= 8; k <<= 1) 26 for (int k = 1; k <= 8; k <<= 1)
29 if (k & turn[d][map[i][j]]) 27 if (k & turn[d][(int)map[i][j]])
30 walk(i+go[k][0], j+go[k][1], k); 28 walk(i+go[k][0], j+go[k][1], k);
31} 29}
32 30

Generated with cgit - Back to sebastiano.tronto.net