Coding Challenge 185: Unfolding Fractals

  Рет қаралды 37,413

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 81
@TheCodingTrain
@TheCodingTrain Ай бұрын
25% off Nature of Code with code CHOOCHOO: natureofcode.com (also includes exclusive sticker+bookmark!)
@vu_derArchitekt
@vu_derArchitekt Ай бұрын
🎉 I pre order the book in July (to Vietnam), waiting for your beautiful sticker and bookmark 😊
@TheCodingTrain
@TheCodingTrain Ай бұрын
@@vu_derArchitektthank you for the support!
@unveil7762
@unveil7762 Ай бұрын
Ah finally I clicked!! But i forgot to apply discount LOL!! I always wanted to have that book, was so hyped !! THANKS!!!!!!!!!!!!each time i see one of your video ,i want to write a shader or do some procedural modelling 🙂
@farazk9729
@farazk9729 20 күн бұрын
Maestro, I just preordered Nature of Code (love the color of the book BTW); I will get it on Dec 10 (I am based in Australia). In the meantime, would you recommend going through the old book? The one with Processing... I have read parts of it, but not the entire book. Would you recommend that or do you think the old book is no longer relevant? Thanks,
@TheCodingTrain
@TheCodingTrain 19 күн бұрын
@@farazk9729 You could still read it yes, however, I'd recommend just reading the new one on the website until the physical book arrives! natureofcode.com/
@frollard
@frollard Ай бұрын
A friend of mine and I coded a version of this for the TI-83 calculator back in high school (holy crap more than 25 years ago)...his version was an insane recursive algorithm because of the memory limitations of the calculator - couldn't write a long list of the segments and do a simple transformation on it to double up and make the next segment. His algorithm actually drew the curve one line at a time...and determined the orientation of each arbitrary line segment up, down, left, or right - as the n'th line of the i'th iteration. That way, he could just draw that one line, then the next, then the next. One of the harder parts was scaling the screen coordinates so that line segments were integer multiples of the number of pixels available to prevent weird moire/aliasing patterns emerging.
@cipherhex
@cipherhex Ай бұрын
If Dan doesn't lose his mind at least once, the Coding Challenge isnt worth watching! 😂 Love it as always!
@Ctrl-Z-Renders
@Ctrl-Z-Renders Ай бұрын
The coding challange is ALWAYS worth watchig!
@Manticore_007
@Manticore_007 Ай бұрын
The added visuals for explaining the code on-the-fly is an awesome addition! I love it
@felizdiacaro
@felizdiacaro Ай бұрын
I found your channel a few days ago and since then every time i have an idea and mention it to someone, a video of you doing it is recommended to me by youtube. that's kinda cool. i ordered the book and i look forward to trying out all this stuff. Thank you!
@TheCodingTrain
@TheCodingTrain Ай бұрын
Thank you for the support and kind words!
@MrQuickLine
@MrQuickLine Ай бұрын
To get the last element, you can do Array.at(-1)
@69zwaan
@69zwaan Ай бұрын
Yes, last segement. Length
@stio_studio
@stio_studio Ай бұрын
Ok, why have no one told me this before? Thanks for the best trick ever!
@MrQuickLine
@MrQuickLine Ай бұрын
@@69zwaan but splice creates a new array, where as .at just references the existing one
@4120_PRATIKRATHOD
@4120_PRATIKRATHOD Ай бұрын
pop() ! 😂
@captainexpo4925
@captainexpo4925 Ай бұрын
@user-sy4sf8gq4p pop() removes the last element as well as returning it.
@thelavagod
@thelavagod 6 күн бұрын
Why does this guy never get old? Literally the only thing that changed (AFAIK) is the color of his hair. His style of videos is still the same as it was 8-9 years back.
@orugma
@orugma 16 күн бұрын
I'd love to see more videos like the Apple ][ Coding Challenges. They were a refreshing change of pace. Or the ones where you worked in the shed.
@markuszeller_official
@markuszeller_official Ай бұрын
Hey Dan. Your book arrived. I LOVE IT.
@TheCodingTrain
@TheCodingTrain Ай бұрын
Yay!! Thank you for the support!
@PatrickHoodDaniel
@PatrickHoodDaniel Ай бұрын
This is a good visual example of compounding.
@kerrykreiter445
@kerrykreiter445 Ай бұрын
That was a fun one to watch!!
@Smoth48
@Smoth48 11 күн бұрын
I am so glad I found this video!! I literally have the dragon curve tattooed on me :D And I drew *lots* of Hilbert curves in school haha
@onebeartoe
@onebeartoe Ай бұрын
I love you Dan. "Except for the very first time"!!!!!!
@RupertBruce
@RupertBruce Ай бұрын
I would have thought that treating each line as a unit and the rotation as simple arithmetic of the number of units in each direction on the path, the problem becomes way easier to compute... Simple turtle movement!
@findjonmoses
@findjonmoses Ай бұрын
Dirtywave M8 is my dessert island instrument…get the MK2. It has a microphone and a bigger battery and a bigger screen. So worth it
@rotten-Z
@rotten-Z 26 күн бұрын
This problem can be solved by constructing an array of integers. The value of an array element is the direction of the "turtle" movement. 0-up, 1-right, 2-down, 3-left. At the first step, the array consists of one element, at each subsequent step, the length of the array increases by two times. The added part of the array is filled with values ​​​​as follows: let N be the length of the array A at the current step. 1) increase the length of the array to 2 * N. Each A [i] element in the range from N + 1 to 2 * N - 1 receives the value A [i] = (A [2 * N-i-1] + 1) % 4. As a result, the right part of the array contains a mirror copy of the left part, rotated 90 degrees to the right. The operation (X + 1) % 4 is the rotation. The result is drawn by calculating the offset of the next point from the previous one in the direction specified by each element of the array A
@r4co351
@r4co351 Ай бұрын
Yet another astonishing intro... Keep up the great work!
@aedyngillion9457
@aedyngillion9457 17 күн бұрын
For the next tutorial could you do a soft body collision but with more in depth collision like the lines collide and it uses a bounding box and all that jazz
@aparrot4254
@aparrot4254 Ай бұрын
Really cool video. Your way of reasoning and debugging seems smart. Talking out loud and kind of explaining the code. Reminds me of rubber duck debugging.
@yujicortkristos3851
@yujicortkristos3851 Ай бұрын
I programmed it once in java by defining 2 functions calling each other. draw() draws a little segment and left() and right() are turning 90°. To start it just call draw() and f(n) right after it: private void f(int n) { if (n > 0) { f(n - 1); left(); draw(); g(n); } } private void g(int n) { if (n > 1) { f(n - 2); right(); draw(); g(n - 1); } }
@dhanupawar3772
@dhanupawar3772 Ай бұрын
Hey Dan why don't you explain some popular generative art codes and how to make them, this is just for learning more from tou generative art community.
@enpeacemusic192
@enpeacemusic192 Ай бұрын
Can you do Newton fractals next? They're not strictly recurring fractals like you have been doing but it's still a really super cool fractal and worth looking into!!
@TheCodingTrain
@TheCodingTrain Ай бұрын
You can add it here! github.com/CodingTrain/Suggestion-Box
@flashbond
@flashbond Ай бұрын
If I were you I would store x and y coordinates of vertecies in a seperate array. Find the max values each time and divide them by 2. I would update my zoom and canvas center according to that.
@TheCodingTrain
@TheCodingTrain Ай бұрын
I like this idea!
@flashbond
@flashbond Ай бұрын
@@TheCodingTrain I am not a programmer. Just a hobbyist :) Your comment means so much to me 🙏 Animation speed may be also adjusted according to circumference of the whole rotating part. Some trigonametry may get involved :)
@HarDarkable
@HarDarkable Ай бұрын
This dot!
@AmandeepSingh-ot5zf
@AmandeepSingh-ot5zf Ай бұрын
hey I caught it in 16 seconds :D
@BrettCooper4702
@BrettCooper4702 Ай бұрын
Line packing to remove lines that already exist / overlap in the array of lines.
@TheCodingTrain
@TheCodingTrain Ай бұрын
Yes, good idea!!
@alessandrofenu4325
@alessandrofenu4325 Ай бұрын
I think it is easy to prove that this doesn’t happen
@md.nournoby4523
@md.nournoby4523 Ай бұрын
The king of js in the planet
@elbananita2245
@elbananita2245 Ай бұрын
love your videos! :)
@69zwaan
@69zwaan Ай бұрын
Geweldig idee, maar je kan ook met image.copy =[] of cretegraphics is dat mijn goede idee?
@gower1973
@gower1973 Ай бұрын
This went from done to car crash in about three minutes flat 😂
@geoffwagner4935
@geoffwagner4935 Ай бұрын
he Billy Mayse'd the challenge with boom
@adrien8768
@adrien8768 Ай бұрын
Hey, great video :) p.s, can you share the QUAD-Tree code please?
@ryaneakins7269
@ryaneakins7269 Ай бұрын
Don Knuth has this curve on his wall at home. There was a Numberphile video about it.
@adminiget1602
@adminiget1602 Ай бұрын
Hi! Can you please make more videos on the Apple ][? Maybe TRY coding a platformer in it? Or graphics mode Snake?
@realcygnus
@realcygnus Ай бұрын
nifty
@rubensjoserosa
@rubensjoserosa Ай бұрын
Hello, Dan! How are you!! Your work is wonderfull! I would like to know if you can ship you book to Brazil.
@TheCodingTrain
@TheCodingTrain Ай бұрын
Can you search local online book retailers? It's being distributed internationally be Penguin Random House so you should be able to find it! Make sure it's the 2024 version and not the 2012 version. Let me know at daniel@thecodingtrain.com b/c lots of folks are asking!
@dansxmods
@dansxmods Ай бұрын
Would love to buy the physical copy of The Nature of Code but shipping to Australia is $56 US and all up it would be just shy of $100 AUD, can you look at a cheaper option to ship to Australia pretty please?
@TheCodingTrain
@TheCodingTrain Ай бұрын
This link should help! www.penguin.com.au/books/the-nature-of-code-9781718503700
@ranawaqas4080
@ranawaqas4080 17 күн бұрын
from 208 i seeing that you only work on p5
@LoPhatKao
@LoPhatKao Ай бұрын
should add something for sale on your NOC site -- signed copies of the book even if it just said "thanks for the support! - Dan" i'd pay extra for it 😊 edit: buying one anyway for my birthday
@TheCodingTrain
@TheCodingTrain Ай бұрын
Unfortunately I don't have an easy way of doing this, but I will be hosting events in NYC where I will sign the book!
@meeper18
@meeper18 Ай бұрын
It’s always this.
@lordofthe6string
@lordofthe6string Ай бұрын
Is this what was in Jurassic Park?
@-Dygex
@-Dygex 27 күн бұрын
can you make tornado :D
@maltezachariassen7496
@maltezachariassen7496 Ай бұрын
You are technically drawing a lot of lines on top of each other.. you could optimize by removing duplicate lines
@PMA_ReginaldBoscoG
@PMA_ReginaldBoscoG Ай бұрын
The book is not available in India. Please do something 🙏
@TheCodingTrain
@TheCodingTrain Ай бұрын
I’m going to ask No Starch about this. It’s being distributed by the publisher internationally! Feel free to contact them on their website also.
@nameundefined6265
@nameundefined6265 Ай бұрын
Haven't watched it full yet, but wouldn't vectors be better than your own segment class?
@piotrlesiakowski7794
@piotrlesiakowski7794 Ай бұрын
Is it a casio calculator watch? :o
@TheCodingTrain
@TheCodingTrain Ай бұрын
indeed, good catch!
@thailonlucasart
@thailonlucasart Ай бұрын
Is there a way I can buy the book in Brazil?
@TheCodingTrain
@TheCodingTrain Ай бұрын
I'm trying to make a list of all the international retailers that carry it for the website Can you find it on here? www.buscalibre.com/ If amazon will ship to you, it will likely have it as well. Let me know!
@TheCodingTrain
@TheCodingTrain Ай бұрын
(Make sure when you look you don't buy the older 2012 version by accident. You can tell by the cover and the publication date)
@RicardoPrediger
@RicardoPrediger Ай бұрын
I'm not the only Brazilian who loves this guy 🎉 I would also like to have this book. I'm a programming teacher and I've been using processing in my classes for 3 years. (BR) Eu não sou o único brasileiro que adora esse cara 🎉 Também gostaria de ter esse livro. Sou professor de programação e a 3 anos uso processing nas minhas aulas
@thailonlucasart
@thailonlucasart Ай бұрын
@@RicardoPrediger akakka Eu assisto o canal há anos! Nem sempre faço tudo oq ele mostra mas me divirto muito vendo ele programar kakakak Sou programador e venho aqui pelas aulas akkaka
@fachriem
@fachriem Ай бұрын
hi there, could you please try game ‘The Farmer was Replaced’ its interactive coding base game using basic python to control the drone to solved maze
@peterbonnema8913
@peterbonnema8913 Ай бұрын
second!
@rainy4226
@rainy4226 Ай бұрын
Hi
Coding Challenge 181: Weighted Voronoi Stippling
28:59
The Coding Train
Рет қаралды 166 М.
Coding Challenge 182: Apollonian Gasket Fractal
56:48
The Coding Train
Рет қаралды 84 М.
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 77 МЛН
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 8 МЛН
Coding Adventure: Sound (and the Fourier Transform)
43:31
Sebastian Lague
Рет қаралды 372 М.
We shot a YouTube video about film formats on 35mm film
22:27
Stand-up Maths
Рет қаралды 481 М.
I tried to Power my Home with Wind Generators! (Worth it?)
12:59
GreatScott!
Рет қаралды 586 М.
Collisions Without a Physics Library! (Coding Challenge 184)
31:05
The Coding Train
Рет қаралды 106 М.
What P vs NP is actually about
17:58
Polylog
Рет қаралды 93 М.
Unexpected Lessons I've Learned After 15 Years Of Coding
43:05
Theo - t3․gg
Рет қаралды 76 М.
How might LLMs store facts | Chapter 7, Deep Learning
22:43
3Blue1Brown
Рет қаралды 510 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН
Coding Challenge 166: ASCII Text Images
22:42
The Coding Train
Рет қаралды 1,1 МЛН
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 921 М.