commit 82e914344d52f9b4c56f83742a0d9dfa495a6e75
parent 8931d043b9238d314839c52816e56c12c6da0350
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Sun, 11 Dec 2022 18:58:13 -0500
Day 9 notes
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/day9/main.c b/day9/main.c
@@ -5,6 +5,18 @@
#define DIMENSION 2000 // Brute forcing because idk the starting point
+// Notes if I want to revisit this:
+// Keep track of all 10 segments like this, modify segment[0] for head and loop
+// through rest of them, comparing the current position to the previous
+// segment's position and applying the same move and visit rules.
+// Perhaps just give up and make a separate grid that keeps track of tiles
+// visited because honestly that's way easier
+
+struct segment {
+ int x;
+ int y;
+};
+
int
main (void)
{
@@ -19,6 +31,7 @@ main (void)
char grid[DIMENSION][DIMENSION] = {{ 0 }};
// Coords are Y,X
+ struct segment segments[10] = { 0 };
int hpos[2] = {DIMENSION/2, DIMENSION/2};
int tpos[2] = {DIMENSION/2, DIMENSION/2};