Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hi, Matthew Trost (author) here. I'm actually a bit mortified that this found its way onto Hacker News, as now my admittedly bush-league JavaScript code is getting the brickbats. :-) In truth, I made it mainly as a practice exercise: code, UI, documentation .... So, please check out the links offered by others here, as many talented folks out there deserve attention for their far-more-sophisticated work!

In any case, I love this discussion. Programming is fun.



Hey Matthew, great job on this! I had fun learning this algorithm, too. My implementation is here: https://github.com/bgrins/javascript-astar/blob/master/astar..., and I have a demo here: http://briangrinstead.com/files/astar/

I have added in a few optimizations: in my first run at it (https://github.com/bgrins/javascript-astar/blob/master/astar...) I used a standard array for the open and closed lists, and I found it slowed down quite a bit as the graph size got larger. I switched the implementation to a binary heap, which made it much faster for larger graphs. Try the original demo then the new one at 100x100 to see what I mean :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: