Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a2273b7

Browse files
committed
Fixed egde case with checking grid bounds
1 parent 5f10131 commit a2273b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/_PathFinder_/AStar/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function AStar(s, e, row, col, inputGrid) {
1111
const end = e;
1212
const path = [];
1313

14-
if (end.i > inputGrid.length || end.j > inputGrid[0].length) {
14+
if (end.i >= inputGrid.length || end.j >= inputGrid[0].length) {
1515
throw new Error('Error: Endpoint outside grid bounds');
1616
}
1717

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /