commit 54fe807e4d4c175d1c433b3a7cc7c5ee0a4805a6
parent 72f028e2a99a4e8f025d108958983ff24cba8f87
Author: finwo <finwo@pm.me>
Date: Thu, 15 Dec 2022 13:32:02 +0100
Disabled whole step 1 for 2022/15
Diffstat:
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/2022/day-15/index.js b/2022/day-15/index.js
@@ -40,11 +40,11 @@ fs.createReadStream('input')
parseInt(beaconTokens[6].replace(/[^\d\-]/g, '')),
];
- // Track in visual representation
- rows[sensorPosition[1]] = rows[sensorPosition[1]] || [];
- rows[sensorPosition[1]][sensorPosition[0]] = 'S';
- rows[beaconPosition[1]] = rows[beaconPosition[1]] || [];
- rows[beaconPosition[1]][beaconPosition[0]] = 'B';
+ // // Track in visual representation
+ // rows[sensorPosition[1]] = rows[sensorPosition[1]] || [];
+ // rows[sensorPosition[1]][sensorPosition[0]] = 'S';
+ // rows[beaconPosition[1]] = rows[beaconPosition[1]] || [];
+ // rows[beaconPosition[1]][beaconPosition[0]] = 'B';
// Calculate distance between beacon and sensor
const d = Math.abs(sensorPosition[0] - beaconPosition[0]) + Math.abs(sensorPosition[1] - beaconPosition[1]);
@@ -55,22 +55,22 @@ fs.createReadStream('input')
d,
});
- // Mark locations that can NOT have a beacon (step 1)
- for(let y=sensorPosition[1]-d; y<=sensorPosition[1]+d; y++) {
- if (!small && y !== scanline) continue;
- const X = d - Math.abs(sensorPosition[1] - y);
- for(let x=sensorPosition[0]-X; x<=sensorPosition[0]+X; x++) {
- const D = Math.abs(sensorPosition[0] - x) + Math.abs(sensorPosition[1] - y);
- if (D > d) continue;
- rows[y] = rows[y] || [];
- rows[y][x] = rows[y][x] || '#';
- }
- }
+ // // Mark locations that can NOT have a beacon (step 1)
+ // for(let y=sensorPosition[1]-d; y<=sensorPosition[1]+d; y++) {
+ // if (!small && y !== scanline) continue;
+ // const X = d - Math.abs(sensorPosition[1] - y);
+ // for(let x=sensorPosition[0]-X; x<=sensorPosition[0]+X; x++) {
+ // const D = Math.abs(sensorPosition[0] - x) + Math.abs(sensorPosition[1] - y);
+ // if (D > d) continue;
+ // rows[y] = rows[y] || [];
+ // rows[y][x] = rows[y][x] || '#';
+ // }
+ // }
- xmin = Math.min(xmin, sensorPosition[0]-d, beaconPosition[0]-d);
- ymin = Math.min(ymin, sensorPosition[1]-d, beaconPosition[1]-d);
- xmax = Math.max(xmax, sensorPosition[0]+d, beaconPosition[0]+d);
- ymax = Math.max(ymax, sensorPosition[1]+d, beaconPosition[1]+d);
+ // xmin = Math.min(xmin, sensorPosition[0]-d, beaconPosition[0]-d);
+ // ymin = Math.min(ymin, sensorPosition[1]-d, beaconPosition[1]-d);
+ // xmax = Math.max(xmax, sensorPosition[0]+d, beaconPosition[0]+d);
+ // ymax = Math.max(ymax, sensorPosition[1]+d, beaconPosition[1]+d);
// console.log({ sensorTokens, sensorPosition, beaconTokens, beaconPosition, d });
cb();