Coding Challenge #107: Sandpiles

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



Duration: 21:21
71,821 views
1,771


In this coding challenge, inspired by Numberphile I visualize "sandpiles" with Processing (Java). Code: https://thecodingtrain.com/challenges/107-sandpiles

πŸ•ΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/47dTVFxuB

πŸŽ₯ Previous video: https://youtu.be/N3ZnNa01BPM?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next video: https://youtu.be/JFugGF1URNo?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸ—„ Sandpile on Wikipedia: https://en.wikipedia.org/wiki/Abelian_sandpile_model
πŸ““ simon-tiger's issue on GitHub: https://github.com/CodingTrain/Rainbow-Topics/issues/815
πŸ’Ύ Processing: https://processing.org

Videos:
πŸŽ₯ Sandpiles: https://youtu.be/1MtEUErz7Gg
πŸ”΄ Livestream Archive: https://youtu.be/_9ZerP7pGvc

Related Coding Challenges:
πŸš‚ #89 Langton's Ant: https://youtu.be/G1EgjgMo48U
πŸš‚ #85 The Game of Life: https://youtu.be/FWSR_7kZuYg
πŸš‚ #102 2D Water Ripple: https://youtu.be/BZUdGqeOD0w

Timestamps:
0:00 Introducing today's topic
1:02 The "sandpile" algorithm
2:28 Maximum amount of sand
5:39 Let's Code!
6:05 Create a 2D array of sandpiles
6:47 Write a render function
7:34 Assign a color based on amount of sand
9:57 Drop a lot of sand in the middle
11:21 Write a topple function
16:16 Correct code to determine nextpiles
17:04 Add rainbow colors
18:00 Call topple multiple times in draw
18:39 Fix edge problem
20:47 Conclusion and creative suggestions

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

#sandpile #cellularautomaton #grid #p5js #processing







Tags:
programming
daniel shiffman
creative coding
coding challenge
tutorial
coding
challenges
coding train
the coding train
live stream
class
challenge
codingtrain
code challenge
sandpile
sandpile algorithm
sandpiles numberphile
sandpile model simulation
sandpiles math
sandpile simulation
sandpile processing