mirror of
https://github.com/Baipyrus/AoC-23.git
synced 2025-02-22 20:21:46 +00:00
prepare a* algorithm
This commit is contained in:
parent
00e53cdbd7
commit
5fa907c64e
@ -11,10 +11,16 @@ const input = readFileSync("input.txt")
|
|||||||
c: +b,
|
c: +b,
|
||||||
x: i,
|
x: i,
|
||||||
y: j,
|
y: j,
|
||||||
d: 0,
|
g: 0,
|
||||||
h: 0
|
h: 0,
|
||||||
})));
|
})));
|
||||||
console.log(input[0].slice(-1)[0]);
|
const man_dist = (a, b) => Math.abs(b.x - a.x) + Math.abs(b.y - a.y);
|
||||||
|
|
||||||
|
const start = input[0][0];
|
||||||
|
const end = input.slice(-1)[0].slice(-1)[0];
|
||||||
|
const open = [start], closed = [];
|
||||||
|
|
||||||
|
console.log(end.g);
|
||||||
|
|
||||||
const t1 = performance.now();
|
const t1 = performance.now();
|
||||||
console.log(`Runtime: ${t1 - t0}ms`);
|
console.log(`Runtime: ${t1 - t0}ms`);
|
||||||
|
Loading…
Reference in New Issue
Block a user