Тёмный

Coding Challenge #14: Fractal Trees - Recursive 

The Coding Train
Подписаться 1,7 млн
Просмотров 890 тыс.
50% 1

In this coding challenge, I'm implement fractal trees with recursion in p5.js. This is the first part of a series on algorithmic botany. Code: thecodingtrain.com/challenges...
🕹️ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/s...
🎥 Previous video: • Coding Challenge #13: ...
🎥 Next video: • Coding Challenge #15: ...
🎥 All videos: • Coding Challenges
References:
🌿 Algorithmic Botany: algorithmicbotany.org/
📕 My NOC class on Kadenze: www.kadenze.com/courses/the-n...
Videos:
🎥 Algorithmic Botany Track: thecodingtrain.com/tracks/alg...
🔴 Coding Train Live 40: • Live Stream #40: Tree...
Related Coding Challenges:
🚂 #15 Object-Oriented Fractal Trees: • Coding Challenge #15: ...
🚂 #174 AppleSoft Basic Fractal Tree: • Apple ][ Coding Challe...
Timestamps:
0:00 Introducing today's topic
0:39 Recursion
2:51 Exit condition
3:53 Let's Code!
5:03 Branch function
10:06 Add slider
13:25 Push and pop functions
14:42 Conclusion and next steps
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: / discord
💖 Membership: ru-vid.comjoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#fractals #generativeart #p5js #javascript

Опубликовано:

 

30 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 556   
@voleNTV
@voleNTV 8 лет назад
Your charisma, and personality is a wonderful break from the usual monotonous programming tutorials. Loving it.
@AngelowasBorn
@AngelowasBorn 7 лет назад
he's way better than my programming instructor :)
@maxiewawa
@maxiewawa 6 лет назад
0:36 "What is a recursive definition?" A recursive definition is a recursive definition.
@johng7602
@johng7602 5 лет назад
I would have give you one more like, but seeing you get 42 likes, and I really don’t want to ruin the number
@binaryteddybear8741
@binaryteddybear8741 5 лет назад
To understand recursion, first you really need to understand something else: recursion
@simonraily330
@simonraily330 4 года назад
GNU as well ;)
@NStripleseven
@NStripleseven 4 года назад
Ah yes, recursion, that word that means recursion
@Inchara-ud4ul
@Inchara-ud4ul Год назад
Very good 😂😂
@starcrAT1
@starcrAT1 6 лет назад
"that was completely unnecessary, but I did it anyway"
@melogenesis4618
@melogenesis4618 5 лет назад
As a cs student, I can easily say that these videos are better than some of the cs courses given in the university
@jhon-zp5sz
@jhon-zp5sz 4 года назад
r u in kerala?
@nizwiz._.5906
@nizwiz._.5906 4 года назад
I've been watching your coding challenges for around 1-2 years now, and I never actually thought to try one of these myself. I'm gonna be doing coding challenges every day now, so fun! But I really love your videos, and I think it's because you don't just show the process of making code, you're also super goofy and you show the process of failing to make code properly, and then fixing it. You're awesome, dude.
@lukealsmith
@lukealsmith 6 лет назад
Holy shit dude, there needs to be more of you at my university! Thanks so much, I am now addicted to your videos
@edopenroz
@edopenroz 8 лет назад
This is so beautiful and inspiring! Thanks for sharing your knowledge, Daniel!
@TheCodingTrain
@TheCodingTrain 8 лет назад
+edopenroz thanks for watching!
@eastonhay
@eastonhay 7 лет назад
I messed around with coding for a little bit and watching these videos make me want to try coding again. You make fantastic videos that explain both the math behind the code and the coding itself. Good Job!
@CoderOfBugs
@CoderOfBugs 7 лет назад
I have been binging these videos. Can't get enough! Keep doing what you do, Daniel!
@Nightlurk
@Nightlurk 7 лет назад
That's not a fractal tree that's a fractal broccoli!
@AkbarSyarif
@AkbarSyarif 7 лет назад
NightLurk this is made my day
@luisgeniole369
@luisgeniole369 5 лет назад
12:30 thats a dragon curve
@samferrer
@samferrer 5 лет назад
NightLurk that is not even a fractal ... just because it looks like a fractal it doesn't mean it is one ...
@12-343
@12-343 5 лет назад
Froccoli
@SabbirAhmed-cm6hk
@SabbirAhmed-cm6hk 5 лет назад
:D
@dreamer097
@dreamer097 7 лет назад
gotta love when you chance upon the exact stuff you've always wanted to learn but never knew where to start. really looking forward to diving into this series!!
@TheCodingTrain
@TheCodingTrain 7 лет назад
thanks, nice to hear!
@cangeylan3714
@cangeylan3714 4 года назад
this was the best video for me to understand what recursive function in general does. i've been watching your videos to learn more complex js and you've been so helpful. thank you so much
@ThisIsMMI
@ThisIsMMI 4 года назад
Wow!! You are probably the happiest programmer on Earth 😁😁 Good job. Keep it up.
@CloudC-kj6kt
@CloudC-kj6kt 2 года назад
what makes you so outstanding than other tutorial video is that you really consider the difficulty learner could face. Thank you so much
@cyanozoid2706
@cyanozoid2706 4 года назад
Man, I got so many details about coding ironed out in this one tutorial. Thank you so much!!
@Lostpanda123
@Lostpanda123 7 лет назад
You make math fun. :)
@MrZakrencony
@MrZakrencony 7 лет назад
Dude, math is always fun
@dubsimmons7508
@dubsimmons7508 5 лет назад
MrZakrencony nooooooo
@garrybogdanho
@garrybogdanho 4 года назад
@@dubsimmons7508 uuuuuuu (get it cuz no u)
@bobbysingh5666
@bobbysingh5666 4 года назад
@@MrZakrencony this is legit fun in scholl you do some + and -
@zaknelson1887
@zaknelson1887 7 лет назад
3:36. "I am Groot! I am Groot! I am Groot!" That being said, your videos have been all been really engaging. I'm so glad I found your channel!
@suraj__7
@suraj__7 5 лет назад
You're so cool, oh so charismatic, you make me believe in myself. Great teacher you are sir, hats off!!
@Sercil00
@Sercil00 6 лет назад
Thanks, this just helped me with some homework that was about to cost my sanity. I just learned about recursion and I find it really difficult to plan far ahead with it. And after hours and hours of trial and error, all the code you got to show for it is so short, you barely have to scroll. Oh well. All the pain is forgotten as soon as it finally does its magic.
@slanglabadang
@slanglabadang 7 лет назад
those push and pop functions make recursive functions so much more simple
@XANA96
@XANA96 2 года назад
This was actually very well explained.. even 6 years later. Thanks!
@bryphi77
@bryphi77 7 лет назад
I think you may have got a bit too excited about "having the trunk". You turned into Dr evil for a second... LOL, you make me laugh!!! Thanks again for all these great vids... I have learned so much from them.
@TheCodingTrain
@TheCodingTrain 7 лет назад
haha, thanks!
@yevheniiherasymchuk
@yevheniiherasymchuk 8 лет назад
so incredible, man! it's can be written under every your video. Thank you for all of this, it's really nice
@TheCodingTrain
@TheCodingTrain 8 лет назад
Thanks for watching!
@Yorcont
@Yorcont 7 лет назад
The way you talk through your tutorials is nice, always seems like you love programming, I'll say you're excited about it and that is transmitted to the viewers, some could say it can be annoying, but right now i find it inspiring, i'm not supposed to be into programming but it's interesting. Thank you for sharing.
@moonlight.sunlight
@moonlight.sunlight 7 лет назад
Your like a gift from God, thanks for sharing your knowledge in such an easy to understand and fun presentation.
@atextful
@atextful 7 лет назад
Daniel Shiffman, you are like a code showman :D. I really loved your book, keep being awesome!
@Rebornedi
@Rebornedi 7 лет назад
Wow this video was so good! Nice job and keep up the good work!
@borjonx
@borjonx 4 года назад
Best. Teacher. Ever. (so far). THANK YOU!!!
@reggaefreaksplayground569
@reggaefreaksplayground569 6 лет назад
soooooo much energy.Dude you need be in a redbull commercial KEEP up the good stuff PEACE
@tarunramesh8539
@tarunramesh8539 7 лет назад
Your book nature of code is one of the most amazing things ive read in my life
@TheCodingTrain
@TheCodingTrain 7 лет назад
So nice to hear thank you!
@MrCrazeyBanana
@MrCrazeyBanana 7 лет назад
I learned how to java script out of you! You are my hero, my inspiration
@Raffaello_Santiz
@Raffaello_Santiz 6 лет назад
Great work! Your videos are ultimately inspirational. You are not so much one who provide knowledge but the one who inspire the students to do great things.
@TheCodingTrain
@TheCodingTrain 6 лет назад
Thank you!
@ChrisOrillia
@ChrisOrillia 6 лет назад
Really good, and worth one's while -- Thank you, sir -- clearly you're the local commanding officer.
@Metamor-phosis
@Metamor-phosis 7 лет назад
Just finished following and (basically copying) the snake challenge, I'm definitily following this one, too... will be my second program in JS! Thank you so much for your videos!
@TheCodingTrain
@TheCodingTrain 7 лет назад
yay, thank you!
@RupertBruce
@RupertBruce 3 года назад
Refactor suggestion: move the block from push to pop to a subbranch(angle) function. You have sold me on this p5 stuff - currently binge-watching your videos. Thank you 🙂
@sebastianfrasher2597
@sebastianfrasher2597 4 года назад
I love this guy. Your videos are educational and entertaining
@selvalakshmivinayagamoorth9965
@selvalakshmivinayagamoorth9965 3 года назад
You are the best teacher I have ever seen. Thank you
@BiswasTharakath
@BiswasTharakath 7 лет назад
This channel is a treasure!!
@aakashyadav8327
@aakashyadav8327 4 года назад
I just love this video thank u for visualizing recursive functions
@f4tm4_f4t4l3
@f4tm4_f4t4l3 7 лет назад
I love every single coding challenge that you did
@TheCodingTrain
@TheCodingTrain 7 лет назад
Thank you so much!
@GarrettStelly
@GarrettStelly 7 лет назад
how are you such a great performer? hardly any cuts or edits and still I'm tuned in.
@0x15k
@0x15k 6 лет назад
You are the best! Thank you for all!
@MRRoeleveld
@MRRoeleveld 5 лет назад
This was a great watch, thanks!
@jithunniks
@jithunniks 6 лет назад
I love it whenever you bring the slider :D
@Linuxdirk
@Linuxdirk 2 года назад
Old video, but the concept is still great. I absolutely love what can be done with properly using recursive functions!
@deltaforce3329
@deltaforce3329 11 месяцев назад
God Bless you Sir !! Thank you for sharing this with us !!
@uwishuwasme69
@uwishuwasme69 7 лет назад
I have no idea about this sort of thing but your a great teacher dude your method is awesome keep it up
@vitorsal1015
@vitorsal1015 3 года назад
Thank you
@nekosalad8308
@nekosalad8308 5 лет назад
best programming channel ever
@vishweshbhalerao6798
@vishweshbhalerao6798 3 года назад
Thank you Dan! It turned out beautiful : )
@andreamichel5115
@andreamichel5115 7 лет назад
I'm glad i recently found about this channel. The way you explain programming is so entertaining and makes me want to try these challenges myself. Keep the good work ( does anyone know about any other channel similar to this one but with C/C++? )
@AnastasisGrammenos
@AnastasisGrammenos 7 лет назад
voidrealms does c++ with QT, i find his tutorials always to the point. Also he has a cat
@Driftload
@Driftload 5 лет назад
9:03 I really want to get good at music sampling and make a remix of all the innocuous funny things you say :D You are such a legend and really good at teaching dude!
@TheCodingTrain
@TheCodingTrain 5 лет назад
I love the remixes so much! There are a bunch here: soundcloud.com/kristianpedersen/sets/coding-rainbow-remixes
@shailendrachauhan130
@shailendrachauhan130 4 года назад
The the way of teaching now I’m being fan of yours
@Pygmygerbil88
@Pygmygerbil88 2 года назад
this man is total energy.
@MehmetEminYayla
@MehmetEminYayla 7 лет назад
You are amazing. Thanks for knowledge...
@majakawalio2631
@majakawalio2631 7 лет назад
Love you bro, you are amazing and such a blessing! THANK YOU!!
@TheCodingTrain
@TheCodingTrain 7 лет назад
Thank you for watching!
@majakawalio2631
@majakawalio2631 7 лет назад
WITH PLEASURE ;'D
@klewood8406
@klewood8406 7 лет назад
thanks this helped me with my AP CSP homework
@anthonyatella
@anthonyatella 7 лет назад
you don't need to push and pop, you just need two calls to branch for each branch call.
@tuga684
@tuga684 6 лет назад
7:55 You got me there 👌😂
@JABigburls
@JABigburls 7 лет назад
You got great videos, good work!
@pyrokinetikrlz
@pyrokinetikrlz 5 лет назад
You almost got a Koch snowflake fractal at 12:37. haahahah. Great channel!!! love it! choooo chooooooooooooo
@elektrozil9728
@elektrozil9728 7 лет назад
D. Shiffman is a Fukin BEAST!!! (in my book)
@Fiskgjusen
@Fiskgjusen 7 лет назад
Alfred Rivera 100% agree
@anamariaarbelaezlopez4783
@anamariaarbelaezlopez4783 Год назад
Thank you for sharing!!! ♥
@tomg8671
@tomg8671 6 лет назад
this is a really good challenge video
@charlie_mk7.5
@charlie_mk7.5 3 года назад
damn I remember doing those a few years back at school using opengl. That was one of the exams, I actually always thought this was one of the easier ones but it looks so great
@vishalshiva14
@vishalshiva14 3 года назад
U are simply amazing👍👍
@christianfernandez7385
@christianfernandez7385 6 лет назад
wow is really awesome!! thank you for this
@Beunique143
@Beunique143 3 года назад
You are great sir. It amazing, wow,and exciting me.👍💝💔💓 Thanks for sharing.
@Deafingblow
@Deafingblow 8 лет назад
I think it would be interesting to see a coding challenge done on a ti-84
@kamoroso94
@kamoroso94 8 лет назад
Oh I love programming on those! It's quite a challenge :)
@TheCodingTrain
@TheCodingTrain 8 лет назад
INteresting idea!
@DR-wr9vq
@DR-wr9vq 5 лет назад
Awesome ! Thanks
@davidportilla4377
@davidportilla4377 7 лет назад
i just love this video
@svanse45.56
@svanse45.56 6 лет назад
I love you and your channel so much. I will try to learn Javascript.
@pcr3323
@pcr3323 6 лет назад
Great sir.. I learn a lot and it's entertaining
@MrLuiyi02
@MrLuiyi02 7 лет назад
Cool video and personality!!
@MetallicDETHmaiden
@MetallicDETHmaiden 6 лет назад
I love this channel!!!!!!!!!
@dangg6767
@dangg6767 7 лет назад
for the first time i feelling regret to leave my IT majors in the university , coding is hell before i see this man . But i think i have to learn coding again . Thanks dude , P.s Sorry for my bad english
@danielszalok8540
@danielszalok8540 7 лет назад
Thank you so much for your videso! If you had been my teacher in high school / university, I would have become a great programmer! :)
@sweethomes674
@sweethomes674 Год назад
Excellent techniques 😊
@nabeelahsan504
@nabeelahsan504 4 года назад
The Bob Ross of coding
@BrettCooper4702
@BrettCooper4702 5 лет назад
Thanks the POP and PUSH was interesting to see used. I added a css style ti make the slide full width but adding this to the setup. slider.style('width', `${width}px`);
@EpicGames1234
@EpicGames1234 5 лет назад
12:18 if you put that first rotate outside of the if statement you get a different generation with a bunch of circles, did it by mistake but it looks really cool
@MaxJoyce1
@MaxJoyce1 7 лет назад
nice one dude, you are funny guy, continue to do this staff )) respect from Russia ;)
@badwolf5117
@badwolf5117 6 лет назад
That Samsung Ad was hilarious! " 'A double Dongle?', 'yeah, a double dongle'..." "That sounds explicit!". WTF? lol
@ps4account165
@ps4account165 6 лет назад
Incredible! For me at least, I’m taking my “second level” programming class, or, whatever you can call it. Ik it must be possible to code these fractal trees in 3D, but can you teach us how? I’m pretty sure it’s not easy, but then maybe? Like, extend Z or something? I’m not sure, I haven’t programmed in 3D just yet.
@TheaustrianLitrix
@TheaustrianLitrix 7 лет назад
i lerned in 15 minutes of ur video more than in 2 years of programming in my school
@haarismian9380
@haarismian9380 7 лет назад
Fantastic video, was wondering which text editor/IDE are you using?
@goxr3plus_studio
@goxr3plus_studio 7 лет назад
Better than any teacher !😀
@benturner4368
@benturner4368 8 лет назад
Flawless transition at 6:00. No one will ever know the truth 😄
@TheCodingTrain
@TheCodingTrain 8 лет назад
haha! Thanks.
@user-vv3tc7yk7f
@user-vv3tc7yk7f 2 месяца назад
Hey, just a suggestion, a really good way to teach recursion is to visualize it as a domino specifically am talking about the "reverse domino effect", the first time I heard of recursion that is what I pictured, I could explain it to you but I am sure you would get it the instant you search "reverse domino effect"...
@gentwebdesign1028
@gentwebdesign1028 4 года назад
Genius!
@smanzoli
@smanzoli 5 лет назад
After the first pop() you´ve pushed and poped again, that´s NOT necessary. Take those 2 lines out, and you´ll be okay. Awesome channel, congrats! (using Processing.py here)
@ShubhamBhushanCC
@ShubhamBhushanCC 7 лет назад
i love this guy
@RakeshGanwani
@RakeshGanwani 7 лет назад
great work!
@arnavnagpal938
@arnavnagpal938 6 лет назад
This is such a great video! I could understand the theory so clearly. I was hoping if you could make the same tutorial for Processing :)
@TheCodingTrain
@TheCodingTrain 6 лет назад
Check out natureofcode.com/book/chapter-8-fractals/ and forgithub.com/shiffman/The-Nature-of-Code-Examples/tree/master/chp08_fractals Processing versions!
@elpianisto26
@elpianisto26 7 лет назад
I am not programming at all but I enjoy listening to your videos
@MistahBradley
@MistahBradley 7 лет назад
I'm subbing to this guy. he'd be an awesome college professor, if he already isn't.
@MRplusfriend
@MRplusfriend 7 лет назад
MistahBradley he actually teaches at a university :)
@MistahBradley
@MistahBradley 7 лет назад
oh nice!
@marythompson9116
@marythompson9116 2 года назад
I was thinking about Dr.Strange's Mirror Dimension but in VR. Remembered Peter in the last movie calling it a fractal. I decided to look up coding fractals because (Im a BS in CompSci and 10yr desktop .net dev) I hate math and recursion equally. I found myself genuinely enjoying this video. I love the visuals and the concept was easy to understand. I'm a bit troubled on how push/pop are working just thrown in there but it's probably just a java thing I don't know. Anyways. Awesome content!
@TheCodingTrain
@TheCodingTrain 2 года назад
I love this story! You should research the "Mandelbulb Fractal" that really is in the mirror dimension! If you want to learn more about push and pop you can start here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-o9sgjuh-CBM.html. Also, I have this video about recursion (that doesn't use push/pop): ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-jPsZwrV9ld0.html in case it helps!
@deadpiece111
@deadpiece111 7 лет назад
i don't know why but i like this channel. (y)
@craigthecat4202
@craigthecat4202 7 лет назад
Super interesting.
@acrossARTS
@acrossARTS 6 лет назад
thank you for making me understand what houdinifx's lsystem is all about ^^
Далее
Coding Challenge #15: Object Oriented Fractal Trees
22:59
5 Simple Steps for Solving Any Recursive Problem
21:03
Coding Challenge #27: Fireworks!
34:35
Просмотров 323 тыс.
Simple Fractal rendering
11:05
Просмотров 132 тыс.
ml5.js 1.0 and Guest Conductor Patt Vira
55:14
Просмотров 2,9 тыс.
Coding the Maurer Rose
13:01
Просмотров 92 тыс.
Coding Challenge #74: Clock with p5.js
20:39
Просмотров 494 тыс.
Creative Coding with p5.js in Visual Studio Code
1:06:09
Coding Challenge #16: L-System Fractal Trees
22:02
Просмотров 226 тыс.