You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (y - 1 >= 0 && !visited[y - 1][x].closed) { is up
and ln 85 if (y + 1 < visited[0].length && !visited[y + 1][x].closed) { is down. Since we move up and down ln 85 should check visited.length not visited[0].length else it can run out of bounds with non square (rectangular) grids. Conversely ln 95 should be flipped to check visited[0].length since that is left and right and the nested arrays represent Xs max size.
I'm enjoying the course. Thanks!
The text was updated successfully, but these errors were encountered:
I think there is a bug with the pathfinding solution where it doesn't get neighbors correctly when the grid isn't square.
algorithms-exercises/specs/pathfinding/pathfinding.solution.test.js
Line 77 in 5b2edb0
if (y - 1 >= 0 && !visited[y - 1][x].closed) {
is upand ln 85
if (y + 1 < visited[0].length && !visited[y + 1][x].closed) {
is down. Since we move up and down ln 85 should checkvisited.length
notvisited[0].length
else it can run out of bounds with non square (rectangular) grids. Conversely ln 95 should be flipped to checkvisited[0].length
since that is left and right and the nested arrays represent Xs max size.I'm enjoying the course. Thanks!
The text was updated successfully, but these errors were encountered: