Skip to content

Commit 79ad4db

Browse files
committed
Merge pull request xtaci#20 from pierredavidbelanger/weighted_astar
Weighted astar
2 parents b25240e + 62252c0 commit 79ad4db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/astar.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ namespace alg {
135135

136136
float tentative = g_score(cy,cx);
137137
if (nx == cx || ny == cy) {
138-
tentative += 1;
138+
tentative += 1 + m_grid(ny,nx);
139139
} else {
140-
tentative += SQRT2;
140+
tentative += (1 + m_grid(ny,nx)) * SQRT2;
141141
}
142142

143143
// if neighbour not in the openset or dist < g_score[neighbour]

0 commit comments

Comments
 (0)