Coding Challenge #53: Random Walker with Vectors and Lévy Flight

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



Duration: 16:18
60,832 views
1,277


In this coding challenge, I simulate a "random walk" with vectors in p5.js, varying the distance of each step size. This is known as a "Lévy Flight" (named after french mathematician Paul Lévy.) Code: https://thecodingtrain.com/challenges/53-random-walker-with-vectors-and-levy-flight

🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/L24X90MBH

🎥 Previous video: https://youtu.be/l__fEY1xanY?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
🎥 Next video: https://youtu.be/sJ6pMLp_IaI?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
🎥 All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
🏛 Lévy Flight on Wikipedia: https://en.wikipedia.org/wiki/L%C3%A9vy_flight
5️⃣ createVector p5.js Reference: https://p5js.org/reference/#/p5/createVector
5️⃣ p5.Vector p5.js Reference: https://p5js.org/reference/#/p5/p5.Vector
📕 My NOC class on Kadenze: https://www.kadenze.com/courses/the-nature-of-code/info
📕 The Nature of Code GitHub (Spring 2017): https://github.com/nature-of-code/NOC-S17-1-Physics-Animation

Videos:
📽 My Videos on Vectors: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZwSmtE13iJBcoI-r4y7iEc
🔴 Live Stream Archive #74: https://youtu.be/mrAeK43YDgw

Related Coding Challenges:
🚂 #52 Random Walker: https://youtu.be/l__fEY1xanY
🚂 #162 Self Avoiding Walk: https://youtu.be/m6-cm6GZ1iw

Timestamps:
0:00 Introduction to the Coding Challenge - vectors and Lévy Flight
2:05 Whiteboard - vectors
4:40 Into the code...create the pos variable (createVector) and use it
6:42 Use the p5.Vector.random2D function to choose a random vector to travel in
8:51 Math with vectors
10:39 Playing with step size and adding in some lines
13:26 Adding in Lévy Flight
15:30 What can you do with this?

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

#randomwalker #levyflight #randomwalk #vectors #probability #p5js #javascript #processing #java







Tags:
JavaScript (Programming Language)
live
programming
daniel shiffman
creative coding
p5.js
coding challenge
p5.js tutorial
p5js
javascript (programming language)
tutorial
javascript
coding
challenges
nature of code
nature of code p5js
nature of code p5.js
random walk
random walker
random walk p5.js
random walk p5js
random walker p5js
random walk javascript
levy flight
levy flight js
levy flight javascript
random walk vectors
p5js vector
javascript vectors