felselva / uastar

Minimal A* implementation in C. No dynamic memory allocation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect arguments provided to the scoring function

Grobnar opened this issue · comments

Hi, I noticed the call to the scoring function in path_finder_find_step reverses the col and row arguments.

path_finder->f_score[n] = path_finder->f_score[n] + path_finder->score_func(path_finder, n / path_finder->cols, n % path_finder->cols, data);
Looks like it should be:
path_finder->f_score[n] = path_finder->f_score[n] + path_finder->score_func(path_finder, n % path_finder->cols, n / path_finder->cols, data);
Just switching the modulus and division.

As a sidenote, great work, I find your code really clean and simple and have been trying to model mine after it since using your library.