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

[ad_1]
In this Coding Challenge, I continue the discussion on Random Walkers. I implement a random walker using vectors in p5.js, which allows me to vary the distance of each step size. I also implement a “Lévy Flight”, named after French Mathematician Paul Lévy.

This video is part of my Spring 2017 course Nature of Code at Tisch NYU (

Previous Coding Challenge on a Random Walker:

Support this channel on Patreon:

The Nature of Code on GitHub (Spring 2017 Class):

Send me your questions and coding challenges!:

Contact:
Twitter:
The Coding Train website:

Links discussed in this video:
Lévy Flight on Wikipedia:
My Videos on Vectors:
Nature of Code Kadenze Course:

Source Code for the all Video Lessons:

p5.js:
Processing:

For my original Nature of Code videos:
For More Coding Challenges:
For an Intro to Programming using p5.js:

Help us caption & translate this video!


Posted

in

by

Tags:

Comments

23 responses to “Coding Challenge #53: Random Walker with Vectors and Lévy Flight”

  1. Jacob Morse Avatar

    I wonder… If I wrote a Random Walks algorithm in Python, would Monty Python sue me for copyright infringement? I wonder if they would have a case for similarity to the classic Ministry of Silly Walks sketch…

    I'm loving these coding challenges. The way you describe the math is excellent. Really looking forward to more awesome challenges.

  2. SeeJay Too Avatar

    one way to get weighted random numbers is to take the minimum of multiple random numbers. that will give you more numbers at the low end of the range. (same goes for getting high numbers, just use the maximum)

    i whipped up a quick version of this challenge to illustrate: https://www.openprocessing.org/sketch/416749

  3. Greg R Avatar

    How would I make a border that the walker could not pass?

  4. realcygnus Avatar

    Damn Dan……a rainbow rider that cant eat berries……such a curse…….I feel 4 u.

  5. Taylor S Avatar

    My late grandmother had severe alzheimer's and loved to walk. Human Lévy Flight? I don't know. Another note: It would be a fun human experiment with VR and random walker directions. You can't see or hear anything other than the app in your headset. I'm imagining a large open room for this. Would be interesting to see how long people trust it before taking it off.

  6. Pandamoaneeum Avatar

    Whut if you had a sort tracking Device to draw on the screen with ?

  7. Zach Albers Avatar

    I'm loving your new intros with the whistle

  8. lamine Pacificatory Avatar

    thanks for the video it is look like game of life but with another way i think but it is so cool 😀

  9. FraznoFire Avatar

    cool train whistle thing

  10. Stu McGorman Avatar

    This is what I made based on your last video on random walks:
    http://stuuuuuuuuuu.x10host.com/random_walk/walk.html

  11. Kaushik Sharma Avatar

    Please show examples like this in Processing.

  12. Jaidan Balea Avatar

    Please code for this I have plans to add more to this concept and can't find source code

  13. Rommel Sánchez Avatar

    Dan, I went from just watching your coding challenges to see the live stream where those come from. What a whole new experience watching you embracing the cringe! Kudos to you for reaching 200k!

  14. exnerhimself Avatar

    I get why you use
    [variable] = [object].copy()
    but is there any use for
    [variable] = [object]
    ?

  15. remokonyogurt Avatar

    "Born….born…born…
    Born to teach p5" ♫

  16. Jan-Stefan Janetzky Avatar

    just came across this today, wich if you think about it, does essentially the same thing: https://www.shadertoy.com/view/MdG3Dd

  17. Jake Macdonald-Mair Avatar

    A good episode of Coding Challenge, in my opinion, would be if you were to code Conway's game of life

  18. Ingo Bartling Avatar

    Your videos are a super inspiration for my lessons at school. And it is interesting you do something, I've already done some years ago with my own turtle-Library: http://ingobartling.de/info/klasse7/html/js_logo/randomwalk.html . For easier usage by my students I also programmed a webinterface for that library. So I do not need to install something: http://ingobartling.de/info/klasse7/html/js_dk/start_jsdk.html .
    By the way, I would be interested in your setup to do this kind of videos. I like you standing in front of the editor and everybody can see you and the things you are programming.I think it's better than the Khan-type of videos.
    I also reprogrammed your A*Star algorithm in Java using the processing-library and BlueJ, because I have to use Java at school. It is quite slow, but it works: http://blog.ingo-bartling.de/2017/01/30/programmieraufgabe-94/

  19. kswof97 Avatar

    What a full beard.

  20. SoyyMilk Avatar

    Could you maybe do an updated version of how to get the p5 editor and get it set up with a web link? I want to get into p5 but the old setup video is a bit outdated 🙂

    Also what editor is that?

  21. Numinous Cranium Avatar

    CODE RAIN!! CODE RAIN!!! MAKE CODE RAIN!!!! CODE RAIN!!!!
    Hey dan! Could you do a "CODE RAIN" challenge :P, just like the PURPLE RAIN challenge. It would be awesome if you could create something that modelled the matrix rain. I have an example here that I created but I think you could create something with trails or a better version that I did, that would be awesome!!!!

    My attempt: :p
    http://igor.gold.ac.uk/~whaq002/projects/code%20rain/coderain.html

  22. MasterFlamaster Avatar

    please. do. a. studio. tour.

Leave a Reply

Your email address will not be published. Required fields are marked *