Coding Challenge #10.2: Maze Generator with p5.js - Part 2

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=D8UgRyRnvXU



Duration: 14:19
164,390 views
2,375


Choo choo! In this multi-part coding challenge, I create a maze generator using a depth-first search algorithm with recursive backtracking. The idea is to walk through a grid of cells, removing walls as we go to build a maze. Code: https://thecodingtrain.com/challenges/10-dfs-maze-generator

๐Ÿ•น๏ธ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/EBkm4txSA

Other Parts of this Challenge:
๐Ÿ“บ Part 1: Creating the Cells: https://youtu.be/HyK_Q5rrcr4
๐Ÿ“บ Part 3: Removing Walls: https://youtu.be/8Ju_uxJ9v44
๐Ÿ“บ Part 4: Backtracking: https://youtu.be/_p5IH0L63wo

๐ŸŽฅ Previous video: https://youtu.be/FGAwi7wpU8c?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ŸŽฅ Next video: https://youtu.be/IKB1hWWedMk?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ŸŽฅ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
๐ŸŒ Maze Generation Algorithm: https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search

Videos:
๐Ÿ”ด Livestream Archive: https://youtu.be/nF7DVmovWr0?t=6228s

Related Coding Challenges:
๐Ÿš‚ #51 A* Pathfinding Algorithm: https://youtu.be/aKYlikFAV4k
๐Ÿš‚ #76 10Print: https://youtu.be/bEyTZ5ZZxZs
๐Ÿš‚ #171 Wave Function Collapse: https://youtu.be/rI_y2GAlQFM

Timestamps:
00:00 Recap from Part 1
00:44 Let's Look at the Algorithm
01:30 Mark the Current Cell as Visited
03:33 Find the Non-Visited Neighboring Cells
09:26 Dealing with Edge Cases
11:28 Select a Random Neighboring Cell
12:12 Visit the Selected Neighbor
13:44 End of Part 2, See You in the Next Part!

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

๐Ÿš‚ Website: http://thecodingtrain.com/
๐Ÿ‘พ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
๐Ÿšฉ Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
๐Ÿ’ก GitHub: https://github.com/CodingTrain
๐Ÿ’ฌ Discord: https://discord.gg/hPuGy2g
๐Ÿ’– Membership: http://youtube.com/thecodingtrain/join
๐Ÿ›’ Store: https://standard.tv/codingtrain
๐Ÿ–‹๏ธ Twitter: https://twitter.com/thecodingtrain
๐Ÿ“ธ Instagram: https://www.instagram.com/the.coding.train/

๐ŸŽฅ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ŸŽฅ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

๐Ÿ”— 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-of-Conduct

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

#maze #recursion #backtracking #depthfirstsearch #p5js #javascript







Tags:
challenge
maze
maze challenge
object oriented programming
programming
p5.js
tutorial
coding challenge
oop
object oriented
programming challenge
p5js
javascript
daniel shiffman
creative coding
javascript (programming language)
html5 canvas
coding
recursive
recursive algorithm
depth-first search
recursion