Coding Challenge 51.1: A* Pathfinding Algorithm – Part 1



In this Coding Challenge, I attempt an implementation of the A* pathfinding algorithm to find the optimal path between two points in a 2D grid. I begin by explaining the mechanics of how the algorithm works, look at pseudo-code, and then write the algorithm in JavaScript using the p5.js library for rendering.

Part 2 focuses on adding obstacles (walls) to the grid as well as functionality for moving diagonally.
.
In Part 3, I look at ways to improve the visual design and invite you to put your own spin on it.

Part 2: https://youtu.be/EaZxUCWAjb0
Part 3: https://youtu.be/jwRT4PCT6RU

Online demo: https://codingtrain.github.io/AStar/
Code: https://github.com/CodingTrain/AStar

To see the whole unedited version of this challenge: https://www.youtube.com/watch?v=S4yQYiAECnM&t=34m50s

Support this channel on Patreon: https://patreon.com/codingtrain

Send me your questions and coding challenges!: https://github.com/CodingTrain/Rainbow-Topics

Contact: https://twitter.com/shiffman

A* Algorithm on Wikipedia: https://en.wikipedia.org/wiki/A*_search_algorithm
Artificial Intelligence: A Modern Approach: http://aima.cs.berkeley.edu/
My Maze Generation Coding Challenge: https://www.youtube.com/watch?v=HyK_Q5rrcr4

Source Code for the all Video Lessons: https://github.com/CodingTrain/Rainbow-Code

p5.js: https://p5js.org/
Processing: https://processing.org

For More Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
For an Intro to Programming using p5.js: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

Help us caption & translate this video!

http://amara.org/v/2el5/

source

Reply


Build A Site Info