Deepwatch

Keyboard shortcuts

Space or k
Play or pause
j and l
Back or forward 10 seconds
Left and right arrows
Back or forward 5 seconds
f
Fullscreen
m
Mute or unmute
Shift and < or >
Slower or faster
?
Show or hide this list

Coding Challenge 162: Self-Avoiding Walk

The Coding Train, 38 min, 158.3K views, Jun 10, 2021

Chapters

Show description

It's finally time to attempt a Self-Avoiding Walk! In this video, I quickly visualize a simple JavaScript p5.js implementation of a self-avoiding walk. I then tackle the more complex problem of backtracking to find a solution to a space-filling self-avoiding walk. https://thecodingtrain.com/challenges/162-self-avoiding-walk p5.js Web Editor Sketches: šŸ•¹ļø Basic Self Avoiding Walk: https://editor.p5js.org/codingtrain/sketches/2_4gyDD_9 šŸ•¹ļø Self Avoiding Walk with Backtracking: https://editor.p5js.org/codingtrain/sketches/dRWS3A9nq šŸ•¹ļø Self Avoiding Walk 3D: https://editor.p5js.org/codingtrain/sketches/D0ONOlCDT šŸ•¹ļø Self Avoiding Walk with Bezier: https://editor.p5js.org/codingtrain/sketches/KFbX0NWgh šŸ•¹ļø Self Avoiding Walk with Recursion: https://editor.p5js.org/codingtrain/sketches/UPxBk1YiB šŸ•¹ļø Random Walk with Alpha: https://editor.p5js.org/codingtrain/sketches/IEw2RkDnJ šŸŽ„ Previous video: https://youtu.be/EvS_a921dBo?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH šŸŽ„ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH Links discussed in this video: šŸ”— Self Avoiding Walk (Wikipedia): https://en.wikipedia.org/wiki/Self-avoiding_walk šŸ”— The complexity of counting self-avoiding walks in subgraphs of two-dimensional grids and hypercubes: https://www.sciencedirect.com/science/article/pii/S030439750300080X šŸ”— The pivot algorithm: A highly efficient Monte Carlo method for the self-avoiding walk (sci-hub): https://sci-hub.st/10.1007/bf01022990 Other videos mentioned in this video: šŸŽ„ Random Walker - Coding Challenge 52: https://youtu.be/l__fEY1xanY šŸŽ„ Minesweeper - Coding Challenge 71: https://youtu.be/LFU5ZlrR21E šŸŽ„ filter() - Array Functions: https://youtu.be/qmnH5MT_luk šŸŽ„ Maze Generator - Coding Challenge 10: https://youtu.be/HyK_Q5rrcr4 šŸŽ„ Recursion - Coding Train 77: https://youtu.be/jPsZwrV9ld0 šŸŽ„ A* Pathfinding Algorithm - Coding Challenge 51: https://youtu.be/aKYlikFAV4k šŸŽ„ 3D Self Avoiding Walk - Coding Train Live (May 27, 2021): https://youtu.be/jlK1SJr-FBc?t=4353 Timestamps: 0:00 Choo choo! Welcome! 1:05 Explain! How can we go about this? 2:29 Code! Let's add a visited grid. 6:25 Code! What are the options for movement now? 10:34 Code! Let's check the edges. 12:34 I could stop here but wait. 13:30 Explain! How can we think about backtracking? 15:15 Code! Let's make a spot class and a path variable. 24:23 Code! Now backtracking! 29:38 Whoops! Copying allOptions was a mistake. 31:19 Code! Maybe we need an end condition. 32:09 Yay! It worked. 32:22 This could take awhile. Could it be improved? šŸš‚ Website: http://thecodingtrain.com/ šŸ‘¾ Share Your Creation! https://thecodingtrain.com/Guides/community-contribution-guide.html 🚩 Suggest Topics: https://github.com/CodingTrain/Rainbow-Topics šŸ’” GitHub: https://github.com/CodingTrain šŸ’¬ Discord: https://discord.gg/hPuGy2g šŸ’– Membership: http://youtube.com/thecodingtrain/join šŸ›’ Store: https://standard.tv/codingtrain šŸ“š Books: https://www.amazon.com/shop/thecodingtrain šŸ–‹ļø 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/website/issues/new

When you're done