A* Pathfinding Algorithm (Coding Challenge 51 - Part 1)

Опубликовано: 22 November 2026
на канале: The Coding Train
3,435,219
24k

In this multi-part coding challenge, I attempt an implementation of the A* Pathfinding Algorithm to find the optimal path between two points in a 2D grid. Code: https://thecodingtrain.com/challenges...

💻 Github Repo: https://github.com/CodingTrain/AStar
🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/s...

Other Parts of this Challenge:
📺 A* Algorithm - Part 2:    • Coding Challenge 51.2: A* Pathfinding Algo...  
📺 A* Algorithm - Part 3:    • Coding Challenge 51.3: A* Pathfinding Algo...  

🎥 Previous video:    • Coding Challenge #50.1: Animated Circle Pa...  
🎥 Next video:    • Random Walker in p5.js (Coding Challenge 52)  
🎥 All videos:    • Coding Challenges  

References:
📘 Artificial Intelligence: A Modern Approach: http://aima.cs.berkeley.edu/
🗄 A* Search Algorithm on Wikipedia: https://en.wikipedia.org/wiki/A*_sear...
💻 Online demo: https://codingtrain.github.io/AStar/

Live Stream Archive:
🔴 Live Stream #72:    • Live Stream #72: A* Pathfinding Algorithm  

Related Coding Challenges:
🚂 #10 Maze Generator:    • Coding Challenge 10: Maze Generator  
🚂 #162 Self Avoiding Walk:    • Coding Challenge 162: Self-Avoiding Walk  

Timestamps:
0:00:00 Introduction
0:01:26 A* Pathfinder
0:09:39 Coding a Grid
0:13:09 A* Pathfinder Algorithm
0:22:07 Choosing Best Available Path
0:27:05 Finding New Nodes
0:38:30 Adding Heuristic
0:41:50 Tracing Back
0:46:49 Using Better Heuristics

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

🚂 Website: http://thecodingtrain.com/
👾 Share Your Creation! https://thecodingtrain.com/guides/pas...
🚩 Suggest Topics: https://github.com/CodingTrain/Sugges...
💡 GitHub: https://github.com/CodingTrain
💬 Discord:   / discord  
💖 Membership: http://youtube.com/thecodingtrain/join
🛒 Store: https://standard.tv/codingtrain
🖋️ Twitter:   / thecodingtrain  
📸 Instagram:   / the.coding.train  

🎥 Coding Challenges:    • Coding Challenges  
🎥 Intro to Programming:    • Start learning here!  

🔗 p5.js: https://p5js.org
🔗 p5.js Web Editor: https://editor.p5js.org/
🔗 Processing: https://processing.org

📄 Code of Conduct: https://github.com/CodingTrain/Code-o...

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod...

#aalgorithm #pathfinding #heuristic #p5js #javascript