Live Stream #39: Q&A and Reaction Diffusion Algorithm

Live from!
In this video, I answer some coding questions submitted by viewers and then I take on a new coding challenge: the Reaction Diffusion Algorithm

12:40 – Question #1: Side Scroller
45:10 – Question #2: Drag Forces with Different Shapes
54:22 – Question #3: p5.js Editor
1:02:20 – Question #4: Spirograph with Attraction Forces
1:10:00 – Question #5: Limitations in Programming
1:20:36 – Presentation of Today’s Challenge
1:51:37 – Reaction Diffusion Algorithm in p5.js
2:34:19 – Back from debugging
2:40:10 – Conclusion

Support this channel on Patreon:
Send me your questions and coding challenges!


Links discussed in this video:
Nature of Code class on Kadenze:
Karl Sims’ Reaction Diffusion Tutorial:
2D Array Tutorial:

Source Code for the Video Lessons:


For More Coding Challenges:

Help us caption & translate this video!






19 responses to “Live Stream #39: Q&A and Reaction Diffusion Algorithm”

  1. Shirish Jadav Avatar

    hey what did you said about making RD faster??? compution behind scene??

  2. C-Zar Avatar

    You should make a platformer like Mario or something for a coding challenge ๐Ÿ™‚

  3. Gabi Avatar

    I love that Reaction Diffusion thing! Very complex, very beautiful. Here's my take on it, mostly your code translated into plain javascript. I've added some color:

  4. Roberto Stelling Avatar

    Hi Daniel,
    Reaction Diffusion is really cool. I've tweaked the code a little bit and added a single Laplace function:
    function lapA(x,y) {
    return lg(x, y, "a");

    function lapB(x,y) {
    return lg(x,y, "b");

    function lg(x,y, ab) {
    var pesos = [[0.05, 0.2, 0.05], // [x-1,y-1][x-1,y][x-1][y+1]
    [ 0.2, -1, 0.2], // [x,y-1][x,y][x,y+1]
    [0.05, 0.2, 0.05]]; // [x+1,y-1][x+1,y][x+1,y+1]
    var soma = 0;
    for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
    soma += grid[x+i-1][y+j-1][ab] * pesos[i][j];
    return soma;

    I'm not happy with performance and color though, will play with it a little more. Is there a place to comment other than youtube ?

  5. Russell Cox Avatar

    After a little bit of digging, I found a web-based computer craft ide that might help keep us all in the browser (code @ You could maybe contribute some processing code to their repository that emulates turtle actions? I don't think that exists in the community anywhere

    Anywho, I'd be interested. Requests: pathfinding, or finite state machine stuff

    Thanks for your videos!

  6. Ivan Ribeiro Avatar

    Laplace functions shouldn't be squared and multiplied by a ? As the formula shows ?

  7. Ian McDonald Avatar

    It does not appear that the code corresponding to this video is within the GitHub repository to which you link.

  8. Fzhe Yang Avatar

    Thank you, Dan. From China ๐Ÿ™‚

  9. bobmandude9889 Avatar

    I would love to see computer craft videos. That's how I originally was introduced into programming.

  10. David Fodor Avatar

    minecraft would be a nice way to attract kids to p5 and maths +UP

  11. Benjamin Deharo Avatar

    Could you do an ascii art generator with p5js please ?

  12. Adrian Cacho Avatar

    Please post this on github!

  13. Artificial Ignorance Avatar

    Who has problem with Dan drinking tea?

  14. Alex Raja Gajah Avatar

    you're awesome Daniel!

  15. Aqib Hasnain Avatar

    Do you have experience with genetic algorithms? I think this would be an interesting topic to learn.

  16. dn Avatar

    aw missed the stream

Leave a Reply

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