feat: finished knights

This commit is contained in:
Mike 2024-02-15 06:38:07 -05:00
parent 2eb3956145
commit 6f8a4ec879

View file

@ -103,10 +103,10 @@ class Graph {
for ( for (
let i = 0; let i = 0;
i < this.adjList[vertex[0]][vertex[1]].length; i < this.adjList[vertex[1]][vertex[0]].length;
i++ i++
) { ) {
let neighbor = this.adjList[vertex[0]][vertex[1]][i]; let neighbor = this.adjList[vertex[1]][vertex[0]][i];
let x = neighbor[0]; let x = neighbor[0];
let y = neighbor[1]; let y = neighbor[1];
@ -146,7 +146,9 @@ class Graph {
} }
let g = new Graph(8, 8); let g = new Graph(8, 8);
console.log(g.adjList[1][2]); console.dir(g.adjList);
console.table(g.adjList[0]);
console.table(g.adjList[0][0]);
g.knightMoves([0, 0], [7, 7]); g.knightMoves([0, 0], [7, 7]);
console.log(g.lookAtBfs()); console.log(g.lookAtBfs());
g.knightMoves([0, 0], [3, 3]); g.knightMoves([0, 0], [3, 3]);