Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Self-Avoiding Walk

Coding Train via YouTube

Overview

Explore the fascinating world of self-avoiding walks in this 38-minute video tutorial. Learn how to implement a basic self-avoiding walk using JavaScript and p5.js, then delve into the more complex challenge of backtracking to create a space-filling self-avoiding walk. Visualize the process step-by-step, starting with a simple grid-based approach and progressing to advanced techniques like backtracking and recursion. Discover how to handle edge cases, create a spot class, and optimize your code for better performance. Gain insights into related concepts such as random walks, maze generation, and pathfinding algorithms. Access multiple p5.js Web Editor sketches to experiment with different variations, including 3D self-avoiding walks and implementations using Bezier curves. Perfect for coding enthusiasts looking to enhance their algorithmic problem-solving skills and create visually engaging projects.

Syllabus

Choo choo! Welcome!.
Explain! How can we go about this?.
Code! Let's add a visited grid..
Code! What are the options for movement now?.
Code! Let's check the edges..
I could stop here but wait..
Explain! How can we think about backtracking?.
Code! Let's make a spot class and a path variable..
Code! Now backtracking!.
Whoops! Copying allOptions was a mistake..
Code! Maybe we need an end condition..
Yay! It worked..
This could take awhile. Could it be improved?.

Taught by

The Coding Train

Reviews

Start your review of Self-Avoiding Walk

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.