I still don't know why part 2 doesn't work. Will check tmrw when I have time.

Change-Id: I83d9ddeb428b2c3317d13472f40d9c0e475de227
Reviewed-on: https://git.clicks.codes/c/Coded/AoC2023/+/164
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..0da0ab6
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,52 @@
+{
+    "version": "0.2.0",
+    "configurations": [
+      {
+        "type": "bun",
+        "request": "launch",
+        "name": "Debug Bun",
+  
+        // The path to a JavaScript or TypeScript file to run.
+        "program": "${file}",
+  
+        // The arguments to pass to the program, if any.
+        "args": [],
+  
+        // The working directory of the program.
+        "cwd": "${workspaceFolder}",
+  
+        // The environment variables to pass to the program.
+        "env": {},
+  
+        // If the environment variables should not be inherited from the parent process.
+        "strictEnv": false,
+  
+        // If the program should be run in watch mode.
+        // This is equivalent to passing `--watch` to the `bun` executable.
+        // You can also set this to "hot" to enable hot reloading using `--hot`.
+        "watchMode": false,
+  
+        // If the debugger should stop on the first line of the program.
+        "stopOnEntry": false,
+  
+        // If the debugger should be disabled. (for example, breakpoints will not be hit)
+        "noDebug": false,
+  
+        // The path to the `bun` executable, defaults to your `PATH` environment variable.
+        "runtime": "bun",
+  
+        // The arguments to pass to the `bun` executable, if any.
+        // Unlike `args`, these are passed to the executable itself, not the program.
+        "runtimeArgs": [],
+      },
+      {
+        "type": "bun",
+        "request": "attach",
+        "name": "Attach to Bun",
+  
+        // The URL of the WebSocket inspector to attach to.
+        // This value can be retrieved by using `bun --inspect`.
+        "url": "ws://localhost:6499/",
+      }
+    ]
+  }
\ No newline at end of file
diff --git a/bun.lockb b/bun.lockb
index 78f3953..9d556bf 100755
--- a/bun.lockb
+++ b/bun.lockb
Binary files differ
diff --git a/day 3/index.ts b/day 3/index.ts
index 06ad2bc..553dab2 100644
--- a/day 3/index.ts
+++ b/day 3/index.ts
@@ -1,6 +1,6 @@
 import { readFileSync } from "fs";
 
-const input = readFileSync('./testdata.txt').toString().split('\n');
+const input = readFileSync('day 3/input.txt').toString().split('\n');
 
 type coord = `${number}:${number}`
 
@@ -36,7 +36,6 @@
          coords[formatCoords(j,i)] = char
       } else {
          const num = checkNumChar(j,i);
-         // console.log(num)
          if(num) coords[formatCoords(j,i)] = num as string
       }
       j++;
@@ -104,10 +103,11 @@
 
 
 // Part 2
-
 let ratio = 0;
 for(const [loc, val] of Object.entries(coords)) {
    if(val !== "*") continue;
+   const toIgnore: coord[] = [];
+
    let curratio = 1;
    let curgears = 0;
 
@@ -123,56 +123,71 @@
    const by = y + 1;
 
    //left
-   if(!isNaN(parseInt(input[y][lx]))) {
+   if(!isNaN(parseInt(input[y][lx])) && !toIgnore.includes(formatCoords(lx,y))) {
       if(coords[formatCoords(lx,y)]) {
-         console.log(`${loc} next to: `)
+         toIgnore.push(formatCoords(lx,y))
          curratio *= parseInt(coords[formatCoords(lx,y)]);
-         curgears++;
+         curgears += 1;
       } else {
          const n = getNumFromRight(lx,y)
+         toIgnore.push(formatCoords(lx,y))
          curratio *= n ? parseInt(coords[n]) : 1
-         curgears++;
+         curgears += 1;
       }
    }
 
    //right
-   if(!isNaN(parseInt(input[y][rx]))) {
+   if(!isNaN(parseInt(input[y][rx])) && !toIgnore.includes(formatCoords(rx,y))) {
       if(coords[formatCoords(rx,y)]) {
+         toIgnore.push(formatCoords(rx,y))
          curratio *= parseInt(coords[formatCoords(rx,y)]);
-         curgears++;
+         curgears += 1;
       } else {
          const n = getNumFromRight(rx,y)
+         toIgnore.push(formatCoords(rx,y))
          curratio *= n ? parseInt(coords[n]) : 1
-         curgears++;
+         curgears += 1;
       }
    }
 
    //above and below
    for(let i = -1; i <= 1; i++) {
       //above
-      if(!isNaN(parseInt(input[ay][x+i]))) {
+      if(!isNaN(parseInt(input[ay][x+i])) && !toIgnore.includes(formatCoords(x+i, ay))) {
          if(coords[formatCoords(x+i,ay)]) {
+            for (let p = 0; p < parseInt(coords[formatCoords(x+i,ay)]).toString().length; p++) {
+               toIgnore.push(formatCoords(x+p+i, ay))
+            }
             curratio *= parseInt(coords[formatCoords(x+i,ay)]);
-            curgears++;
+            curgears += 1;
          } else {
             const n = getNumFromRight(x+i,ay)
+            for (let p = 0; p < parseInt(coords[n]).toString().length; p++) {
+               toIgnore.push(formatCoords(x+p+i, ay))
+            }
             curratio *= n ? parseInt(coords[n]) : 1
-            curgears++;
+            curgears += 1;
          }
       }
       //below
-      if(!isNaN(parseInt(input[by][x+i]))) {
+      if(!isNaN(parseInt(input[by][x+i])) && !toIgnore.includes(formatCoords(x+i, by))) {
          if(coords[formatCoords(x+i,by)]) {
+            for (let p = 0; p < parseInt(coords[formatCoords(x+i,ay)]).toString().length; p++) {
+               toIgnore.push(formatCoords(x+p+i, by))
+            }
             curratio *= parseInt(coords[formatCoords(x+i,by)]);
-            curgears++;
+            curgears += 1;
          } else {
             const n = getNumFromRight(x+i,by)
+            for (let p = 0; p < parseInt(coords[n]).toString().length; p++) {
+               toIgnore.push(formatCoords(x+p+i, by))
+            }
             curratio *= n ? parseInt(coords[n]) : 1
-            curgears++;
+            curgears += 1;
          }
       }
    }
    if(curgears === 2) ratio += curratio
 }
 
-console.log(ratio)
\ No newline at end of file
+console.log(ratio)
diff --git a/tsconfig.json b/tsconfig.json
index dfe48b8..fa72959 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -15,6 +15,7 @@
     "allowSyntheticDefaultImports": true,
     "forceConsistentCasingInFileNames": true,
     "allowJs": true,
+    "sourceMap": true,
     "types": [
       "bun-types" // add Bun global
     ]